stdx::IndirectItr Class Template Reference
template<class I>
class stdx::IndirectItr< I >
Often we want to iterate through a container of pointers, but we want it to appear like we are iterating through a container of references to the objects the original pointers pointed to. We can do this with a new iterator which adds an extra dereference. This allows the following code to work:
list<int*> lst; // ... fill the lst with pointers to ints ... copy( indirect_iseq(lst), ostream_iterator<int>(cout) );
Notice that because we are using indirect iterators, the actual ints are copied to the output iterator, not the pointers to the ints.
Public Types
Public Methods
- IndirectItr ()
- IndirectItr (I baseItr)
- operator * () const
- operator-> () const
- operator[] (difference_type n) const
- operator+ (difference_type n) const
- operator+= (difference_type n)
- operator- (difference_type n) const
- operator-= (difference_type n)
- operator++ (int)
- operator++ ()
- operator-- (int)
- operator-- ()
- base () const