Hi !

I have lots of STL lists, lets say
list< A* > m_listA;
list< B* > m_listB;
list< C* > m_listC;
…..
where B derives from A, and C from B,….

Many times I have to return two or more different lists as one result, e.g.

list<A*> getList()
{
// return elements of m_listA + elements of m_listB
}

Of course, I can solve this by something like:

list< A* > res = m_listA;
List< B* >::iterator it = m_ListB.begin();
while( it != m_ListB.end() )
{
res.push_back( *it );
it++;
}

.. But it's annyoing to write this everytime I have to add two lists.

Do you have any ideas how to handle this typesafe, fast, fast-to-write,….. ?


Best regards,
Chris