r/learncpp • u/omen_tenebris • Jun 25 '20
list of c style arrays
Hey. In my code implementation i have something like this
struct MYTABLE
{
int table[NUMBER][NUMBER];
}
where NUMBER is a constant and is decided in compile time with a define.
After some calculations i have a number of results that i'd like to store. These number of results are varied dependent on the size of the matrix (the bigger the NUMBER the more i get).
Is there an solution where i can make something like this:
std::list<MYTABLE> result_set;
result_set later needs to be iterated trough and picked out results that are each others mirrors, rotations etc
Thank you!
1
Upvotes
View all comments
Show parent comment
3
u/jedwardsol Jun 25 '20 edited Jun 25 '20
Ah, you're trying to put an array in the list, not a struct which has an array as a member. Although they're superficially very similar, they're pretty different in what operations the language allows to be performed upon them.
3 suggestions
A(the array) into a struct (my_table) and then insert the struct into the list.Afrom an array to amy_table.The last can be done with
and continue using the
my_tabletype everywhere.