Boost logo

Boost :

Subject: Re: [boost] [iterator] Silent-but-deadly bug in iterator_facade category
From: Gabriel Redner (gredner_at_[hidden])
Date: 2013-05-06 17:42:11

Hi Paul,

Thanks for your reply.

> For it to be a
> `std::random_access_iterator_tag` it must a reference. That is,
> `iterator_traits<X>::reference` must be an actual reference.

Can you point me at a reference (pun not intended) for this
requirement? The sites I've looked at don't mention this [1-3]. Is
it a requirement for, say, bidirectional iterators too? Your message
makes it sound like this is specific to random access iterators.

If the iterator's reference must be a real reference type, then why
does iterator_facade not check this at compile time?

And in any case, isn't this a flaw? my_iterator can be advanced etc.
in constant time - why should the STL be forced to use a
possibly-suboptimal overload of some algorithm on account of the
reference type?



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