Boost logo

Boost :

From: Andrey Semashev (andysem_at_[hidden])
Date: 2007-05-14 07:44:02

Hello shunsuke,

Monday, May 14, 2007, 1:58:37 PM, you wrote:

> Andrey Semashev wrote:
>>> The New Iterator concept defines Readable and Writable concept,
>>> but I don't know the definition of "constant" iterator.
>>> Well, I think 'iterator_reference<ItT>::type' can return a
>>> const-qualified type even if 'ItT' is Writable.
>> I don't see how would it be possible to write to a const.

> Proxy object like vector<bool>?

Dereferencing its iterators yelds rvalues which are not const (at
least are not required to be). It is, in fact, possible to create a
non-const iterator which has a const reference type, but such cases
are, uh, a bit strange to say the least.

Currently is_const_iterator will result to true only if the iterator
reference type is const value or const reference. I'm not sure how it
should behave for iterators with a non-const value reference types and
vector< bool >::iterator specifically. I'm leaving this to users to
define by specializing is_const_iterator on their iterator types.
Maybe there should exist specialization on
vector< bool >::const_iterator right out of the box?

Best regards,
 Andrey                            mailto:andysem_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at