C++ initializer lists

One of the cool new features in C++ is initializer lists. Here’s an example from Wikipedia:


struct Object
{
float first;
int second;
};

Object scalar = {0.43f, 10}; // One Object, with first=0.43f and second=10
Object anArray[] = {{13.4f, 3}, {43.28f, 29}, {5.934f, 17}}; // An array of three Objects

There’s another example over at stackoverflow.

IBM has published the useful C++0x feature support in GCC 4.5.