The story begins with something I thought pretty simple :
I need to design a class that will use some STL containers. I need to give users of the class access to an
You need a custom data structure iterator, a wrapper around your private list.
template
class inmutable_list_it {
public:
inmutable_list_it(std::list* real_list) : real_list_(real_list) {}
T first() { return *(real_list_->begin()); }
// Reset Iteration
void reset() { it_ = real_list_->begin(); }
// Returns current item
T current() { return *it_; }
// Returns true if the iterator has a next element.
bool hasNext();
private:
std::list* real_list_;
std::list::iterator it_;
};