// The class you want to have an iterator
// Need to implement begin() and end() interfaces
class ListOfList {
list<list<int> > s;
MyIterator begin();
MyIterator end();
}
// The customized iterator
// Need to implement *, ++, ==, != interfaces
class MyIterator {
public:
MyIterator();
~MyIterator();
bool isEnd();
const Value &operator*();
MyIterator &operator++();
bool operator==(const MyIterator &itr);
bool operator!=(const MyIterator &itr);
private:
// add your own private member variables here
};
C++ Iterator Overloading
最新推荐文章于 2023-10-26 17:40:35 发布