<> wrote in message
news: oups.com...
| Is it possible to populate a container with an initializer list? I am
| not too particular about how hackish or ugly any suggestions might be,
| I'm simply interested in investigating possible elegancies (or
| perversities) for an initializer list.
|
| const container<double> array = mitigating_struct<double>() = {pi, e,
| phi, gamma, 0.0042};
| // container is magically filled with initalizer list members
|
| Of course, something without an explicit temporary would be more ideal,
| but perhaps beyond the realm of C++.
maybe boost.assign will be just what you want (see
www.boost.org) It will be
in the next boost release, but you can
already get it from the main cvs if you want.
Shortly put (and among other ways), it allows you to say
const container<double> array = list_of<double>( pi )( e )( phi )( gamma )(
0.00042 );
br
Thorsten