Boost logo

Boost :

From: AlisdairM (alisdair.meredith_at_[hidden])
Date: 2006-03-16 06:39:12


John Maddock wrote:

> Hold your horses here: surely const char* most certainly is a random
> access iterator, albeit an immutable one. I don't see anything in
> 24.1 that requires OutputIterator semantics for anything except, well
> output iterators :-)

24.1p3:

"Forward iterators satisfy all the requirements of the input and output
iterators and can be used whenever either kind is specified;
Bidirectional iterators also satisfy all the requirements of the
forward iterators and can be used whenever a forward iterator is
specified; Random access iterators also satisfy all the requirements of
bidirectional iterators and can be used whenever a bidirectional
iterator is specified."

However, it has since been pointed out to me I was ignoring 24.1p4:

"Besides its category, a forward, bidirectional, or random access
iterator can also be mutable or constant depending on whether the
result of the expression *i behaves as a reference or as a reference to
a constant."

which seems to contradict the previous paragraph, but is more
consistent with expected use through the rest of the library.

I am now no longer sure what is/is-not a random access iterator
according to C++03, but supect the intent is to support-but-not-require
output-iterator. Hopefully we can clear this up once and for all in
the next standard.

-- 
AlisdairM

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