This cannot be done in current C ++, as defined by C ++ 03.
The function you are looking for is called compound literals. It is present in C, as defined by C99 (with certain features of C, of course), but not in C ++.
A similar function is also planned for C ++, but it is not there yet.
AnT
source share