I need to create a data structure that has a LOT of members. Example:
struct MyStruct {
int varSomething;
int helloNumber;
int thisIsSomething;
...
int varNumber50;//50th element
}
The problem with this struct is that when I want to instantiate it, I need to do the following:
my_vector[i] = MyStruct{10, 4, 90, ...}
as you can see, I need to put lots of values and I end up confusing which one is which. Ideally, I'd like to do something like this:
my_vector[i] = MyStruct{varSomething = 10, helloNumber = 4, thisIsSomething = 90, ...}
Since each variable has a name, I know what I'm doing, and can't confuse.
I know that I can do this:
MyStruct myStruct;
MyStruct.varSomething = 10;
myStruct.helloNumber = 4;
...
my_vector[i] = myStruct
but I want to create an anonymous struct, it's not nice to create a named struct just to put in the vector.
What should be a great way to solve this problem? Is there something similar to a struct that can achieve what I want??