16 Nov
2006
16 Nov
'06
8:43 a.m.
Hughes, James wrote:
map
mapstuff = map_list_of (1, {"hello", list_of (3) (4) (2) } ), // note curly braces (3, {"goodbye", list_of (1) (3) ) } ); But that doesn't work either.
Is it actually possible to do something like this, and if so, how?
I suspect that you have to provide a constructor for your data class:
template< class Range > data( const char* str, const Range& r ) : str(str), stuff(boost::begin(r),boost::end(r)) { }
I did something along these lines but still got a load of compile faults. Will post a more accurate code snippet when time allows, but have a deadline end of today!!
You also need to call the constructor when you call map_list_of(): map_list_of(1, data( "hello", list_of(3)(4)(4) ) ); -Thorsten