Populating array of objects in compact fashion

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:
1
2
3
  binList[0].binNumber = 1;
  binList[0].partDescription = "Valve";
  binList[0].numberOfPartsInBin = 10;

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 );
Ok, got it.
This gives me the following expression
1
2
binList[0] = Bins(1, "Valve", 19);
binList[1] = Bins(2, "Bearing", 5);
binList[9] = Bins(10, "Rod", 12);

But if I wouldn't have initialized the array beforehand, I could have done this:

 
Bins binList[10] = { Bins(1, "Valve", 19), Bins(2, "Bearing", 5),

Right?

Is it possible to get this compact even when the array is already initialized?
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
Ok, thanks a lot for the advice , and the quick answer!
Topic archived. No new replies allowed.