I have a class that contains a structure and a declaration of an array containing 10 of the structures.
A member function of the class is supposed to populate the array, which I am doing in this fashion:
Is it possible to do this in a more compact way? If I would have created the array and populated it at the same time I could have done it with a constructor in a compact way, but this way is not possible if I want to declare the array as a member in the class declaration, right?
If your struct has a constructor and you didn't remove the default assignment operator, you can do this: binList[0] = name_of_the_struct ( 1, "Valve", 10 );
Not with the current standard but in C++0x the meaning of the { } initialization would be extended so it may be possible, at least for std containers if not for arrays, with the future standards