Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class list_iterator {
- element* data;
- public:
- list_iterator(element* _data) : data(_data) {}
- list_iterator& operator++ (){
- if (data == nullptr) {
- throw new exception();
- }
- element* temp = data;
- data = data->next;
- return list_iterator(temp);
- }
- int operator* () {
- return data->data;
- }
- friend bool operator== (const list_iterator left, const list_iterator right) {}
- };
- ...
- list_iterator begin () {
- return list_iterator(head);
- }
- list_iterator end () {
- return list_iterator(nullptr);
- }
Advertisement
Add Comment
Please, Sign In to add comment