![]() |
relation between std::iterator and other container iterators
Hi!
What's the relation between std::iterator and the iterators provided by various containers? How do the concepts of five categories of iterators be implementated by these iterator classes including std::iterator and various container iterators? Thank you for your time. |
Re: relation between std::iterator and other container iterators
lovecreatesbea...@gmail.com a écrit :
> Hi! > > What's the relation between std::iterator and the iterators provided > by various containers? How do the concepts of five categories of > iterators be implementated by these iterator classes including > std::iterator and various container iterators? std::iterator only defines a bunch of typedefs. It is basically an helper class; you can define an iterator without inheriting from it, provided to provide the relevant nested typedefs. The various iterators concepts are described in STL SGI: http://www.sgi.com/tech/stl/Iterators.html - InputIterators may be dereferenced for reading and can only be incremented and a range cannot be used more than once. - OutputIterators can be dereferenced for writing and can only be incremented and a range cannot be used more than once. - ForwardIterators guarantee that you can use a range more than once (by example if you have an algorithm with more than one pass). But they can only be increamented (like in a simple list). - BidirectionalIterators are like the ForwardIterators but iterators can be decremented (like in a double ended list). - RandomIterators are like BidirectionalIterators but you can directly access an iterator at a given distance from another iterator (typically an array). Michael |
| All times are GMT. The time now is 08:29 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.