I have a class TContainer that is an aggregate of several stl collections pointers to TItems class.
I need to create an Iterator to traverse the elements in all the collections in my TContainer class abstracting the client of the inner workings.
What would be a good way to do this?. Should I crate a class that extends an iterator (if so, what iterator class should I extend), should I create an iterator class that is an aggregate of iterators?
I only need a FORWARD_ONLY iterator.
I.E, If this is my container:
typedef std::vector <TItem*> ItemVector;
class TContainer {
std::vector <ItemVector *> m_Items;
};
What would be a good Iterator to traverse all the items contained in the vectors of the m_Items member variable.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…