What to return as an iterator when there is no container?
Posted
by
DaClown
on Stack Overflow
See other posts from Stack Overflow
or by DaClown
Published on 2011-02-03T23:24:27Z
Indexed on
2011/02/03
23:25 UTC
Read the original article
Hit count: 220
I have an inheritance structure of objects with begin() and end() as pure virtual member functions in the base class. From this objects I'm planning to build a composite structure. This inner objects have std::vector member the begin() and end() get their data from. But in a leaf class there is no vector. Now I try to find a return value for begin() and end() in the leaf classes. What would be a good way to do that?
The easiest way would be to have a vector member in the leaf classes with no elements in it to fuel begin() and end(), but this just doesn't feel right.
© Stack Overflow or respective owner