#ifndef OPP_ITERATOR_H #define OPP_ITERATOR_H namespace opp { template class back_insert_iterator { protected: CT * co; public: back_insert_iterator (CT & c) : co(&c) {} back_insert_iterator & operator= (const CT::element_type & t) { co->push_back(t); return *this; } back_insert_iterator & operator= (CT::element_type && t) { co->push_back(t); return *this; } back_insert_iterator & operator* (void) { return *this; } back_insert_iterator & operator++ (void) { return *this; } back_insert_iterator operator++ (int) { return *this; } }; template class front_insert_iterator { protected: CT * co; public: front_insert_iterator (CT & c) : co(&c) {} front_insert_iterator & operator= (const CT::element_type & t) { co->push_front(t); return *this; } front_insert_iterator & operator= (CT::element_type && t) { co->push_front(t); return *this; } front_insert_iterator & operator* (void) { return *this; } front_insert_iterator & operator++ (void) { return *this; } front_insert_iterator operator++ (int) { return *this; } }; template class insert_iterator { protected: CT * co; CT::iterator_type ci; public: insert_iterator (CT & c, const CT::iterator_type & i) : co(&c), ci(i) {} insert_iterator & operator= (const CT::element_type & t) { ci = co->insert(ci, t); ++ci; return *this; } insert_iterator & operator= (CT::element_type && t) { ci = co->insert(ci, t); ++ci; return *this; } insert_iterator & operator* (void) { return *this; } insert_iterator & operator++ (void) { return *this; } insert_iterator operator++ (int) { return *this; } }; template front_insert_iterator front_inserter (CT & c) { return front_insert_iterator(c); } template back_insert_iterator back_inserter (CT & c) { return back_insert_iterator(c); } template insert_iterator inserter (CT & c, const CT::iterator_type & i) { return insert_iterator(c, i); } }