Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-04-09 19:23:51

Ion Gaztañaga <igaztanaga_at_[hidden]> writes:

>> You haven't really explained what this thing is supposed to be doing.
>> As far as I can tell from the code, it dereferences to the same
>> location at each position. If that's really what you intend, you
>> ought to do something to ensure that its iterator category doesn't
>> indicate it satisfies forward iterator requirements.
> A pair of "range_from_ref_iterator" simulates a pair of random access
> iterators that point to an array of N identical values.

It's not a legal random access (or even forward) iterator if it
visits the same *element* more than once in a traversal. That's why I
said the above about the iterator category.

>> Seems like a reasonable idea, but I'm not sure whether it's useful
>> enough to be included. I'd definitely call it something other than
>> range_from_ref_iterator, though. constant_iterator or something like
>> that seems appropriate.
> constant_iterator seems good,

Whoops, "constant iterator" is already overloaded with a different
meaning. Something else, maybe... "repeat iterator?"

Dave Abrahams
Boost Consulting

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