From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-10-13 10:07:51
Daniel Frey <daniel.frey_at_[hidden]> writes:
| Gabriel Dos Reis wrote:
| > Howard Hinnant <hinnant_at_[hidden]> writes:
| > [...]
| > | I do not believe it is a good argument for making
| > | temporaries const. --c.end() is not inherently unsafe. It simply does
| > | not work if the iterator turns out to be a pointer. This is a quirk of
| > | the language and nothing more.
| > Indeed. I see decrementation or incrementation as part of the
| > iterator interface (supported operations) and from that perspective,
| > it makes perfect sense to say --c.end(). I see no "unsafety" in that
| > constructs.
| It's not really unsafety, but it limits you in development,
Really? Right now, it doesn't.
| e.g. you
| cannot have a "end"-object in your container and return a reference to
| it. The reference must be const in order to work safely, so if you
| change the function from
| iterator end() const;
| iterator& end() const;
Well, I would say it is that change that may be a limit since I expect
an iterator to be an _object_ -- from all the various definitions I've
worked with, iterators were values.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk