
Oops, some typos here. Vinzenz 'evilissimo' Feenstra schrieb:
Hi,
I am wondering how your example container looks like, since it seems to contain several types.
If container is a container containing containers with values, you could do something like this:
[code] vectorcontainer::value_type::value_type flattened; for(container::iterator it = c.begin(), end = c.end();beg != end; ++it) flattened(it->begin(), it->end(), std::back_inserter(flattened)); [/code] Should be: [code] std::vectorcontainer::value_type::value_type flattened; for(container::iterator it = c.begin(), end = c.end();beg != end; ++it) std::copy(it->begin(), it->end(), std::back_inserter(flattened)); [/code]
Regards, Vinzenz
chun ping wang schrieb:
Is their some kind of method to flatten a stl container...
example [[1, 4], [a,b, c], [b, [e]] ] becomes [1, 4, a, b, c, b, e]
Sorry for the mistake. Regards, Vinzenz