I have two classes A
and B
, and an implicit conversion operator exists to go from one to the other, so that:
A a;
B b;
b = a; // Works
Is there a standard way to convert a std::list<A>
to a std::list<B>
? (Or even from std::vector<A>
to a std::list<B>
).
I know I can iterate trough to the list and build the second list item by item, but I wonder if there is a more elegant solution.
Unfortunately I cannot use boost
but out of curiosity as a bonus question, if boost can handle this, I'd be happy to know how too.