Hughes, James wrote:
Clip..
{ }
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 ____
Thanks Thorsten, that did the trick. I had actually tried something along those line when trying to figure it out myself, but didn't know how to handle the range stuff you put in your example. Thanks again.
You're welcome. It will work if you have a normal vector<int> there too, although that is slower.
As a sort of aside, this example would make a good addition to the documentation, for those coming to C++ from C where this sort of nested structure initialisation is common (well, in my world it is!).
I'll leave that as a todo. It is already documented that the result of list_of() is a Range. -Thorsten