Listing 2: Excerpt from the view's interface.
template < typename StoredIterator, class Container = std::vector<StoredIterator>> class view { public: // iterators for transparent access typedef view_iterator<typename Container::iterator> iterator; typedef view_iterator<typename Container::const_iterator> const_iterator; // iterators for raw container traversal typedef typename Container::iterator v_iterator; typedef typename Container::const_iterator v_const_iterator; // ... // iterators: iterator begin() { return iterator(container_.begin()); } iterator end() { return iterator(container_.end()); } // ... // raw container iterators: v_iterator v_begin() { return container_.begin(); } v_iterator v_end() { return container_.end(); } // capacity: size_type size() const { return container_.size(); } // ... // element access: reference operator[](size_type n) { return *(container_[n]); } // ... // modifiers: void push_back(const StoredIterator &i) { container_.push_back(i); } // ... private: Container container_; };