class AIterator : public TIterator
{
public:
AIterator(const A& a, some_range);
private:
TIterator* fHelperIterator;
};
where fHelperIterator I get from A::CreateIterator() for instance. This one iterates over all values in a. Now I want AIterator to loop only over a given range. So AIterator reuses the iterator on a, and filters the results. That way AIterator can “reuse” a’s iterator, whatever that one is.
Problem in this case is that when copying one AIterator into another one, I do not want to share the fHelperIterator pointers, but get two separate ones, and this I don’t know how to do without a Clone :