Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-06-13 07:42:57


From: "Yitzhak Sapir" <yitzhaks_at_[hidden]>

> Why is it necessary that v.begin() return something addressable for the
iterator to count as forward iterator? If I implement a "forward" iterator
whose iterator_traits::value_type is a proxy (as opposed to an iterator
that returns a proxy to it's value_type) why wouldn't it be a forward
iterator?

Because 24.1.3 says so. RTFStandard.

> I ask this because I'd obviously like to learn, and I had thought that
while proxies are problematic in a forward iterator, if the iterator was an
iterator to the proxy class it was ok (and my thinking may have been wrong
on the issue).

Proxies are allowed for output iterators.

They are sort-of allowed for input iterators, but then you couldn't ever
write through the iterator in a postincrement expression:

    *r++ = x; // illegal, *r++ must return value_type.

Them's the rules.

if-ya-don't-likes-em-ya-gots-ta-change-em-ly y'rs,
dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk