What to return as an iterator when there is no container?
- by DaClown
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.