M
Martin
I have two classes that implements 3D point clouds: M and S. I want
both classes to implement an iterator to iterate over the points
contained in each object, and have a points() method to give a pair of
iterators to the first and the past-the-end element, like this:
std:air< M:oint_Iterator, M:oint_Iterator > M:oints();
std:air< S:oint_Iterator, S:oint_Iterator > M:oints();
The iterator implementation needs to be different, since the classes
store the points in quite different ways. But algorithms working with
point clouds should work with both classes.
How should I do this? I can use common inheritance from a base class
(B) for all other shared methods, of course, but you can't have
virtual nested classes, right?
I hope my question is understandable.
both classes to implement an iterator to iterate over the points
contained in each object, and have a points() method to give a pair of
iterators to the first and the past-the-end element, like this:
std:air< M:oint_Iterator, M:oint_Iterator > M:oints();
std:air< S:oint_Iterator, S:oint_Iterator > M:oints();
The iterator implementation needs to be different, since the classes
store the points in quite different ways. But algorithms working with
point clouds should work with both classes.
How should I do this? I can use common inheritance from a base class
(B) for all other shared methods, of course, but you can't have
virtual nested classes, right?
I hope my question is understandable.