Topic: Is postincrement necessary?


Author: jhurd@my-deja.com
Date: 1999/08/16
Raw View
Has someone out there experimented with a weaker notion of an iterator
that does not support postincrement, where the iterator cannot be
copied in constant time? It seems that most of the STL algorithms can
work with such an iterator, although at least one implementation I have
looked at seems to haphazardly use postincrement when preincrement
would have done just as well.

It is troublesome to support fast iterator copy on some iterators, like
database queries, since it requires extra copying to keep the old
records around. Better I suppose, to make the library user do their own
copying as needed.

It is equally troublesome to define a parallel set of algorithms for
such non-copying iterators when most algorithms work just fine
implemented in the customary way. But if such behavior couldn't be
guaranteed, then I would be just be building in a portability problem.

Jim


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]