Boost logo

Boost :

From: rogeeff (rogeeff_at_[hidden])
Date: 2002-02-19 01:09:56


--- In boost_at_y..., Thomas Witt <witt_at_i...> wrote:
> Gennadiy
>

[...]

> The main changes are:
>
> Added a const here and there.

The only placewhere I would agree to put const in constructor: const&
instead of value. You can't make class data members const. First of
all it prevent implementing mutable iterators and second you can't
even assign const iterator. Also I do not see any paractical reasons
in defining local veriables in 2 line inline function const. Do you?

>
> Added make_cycle_iterator with iterator position (+ only works for
random
> access iterators). What do you think about the interface.
Specifying three
> iterators seemed to error prone to me.

I do not like the idea by itself. Since you can't check that this
iterator position is in a range it could be very dengerous. For
example, surprisingly the following statement would be an infinite
loop:

v - some container

std::copy( boost::make_cycle_iterator( v ),
           boost::make_cycle_iterator( v.end(), v ),
           std::ostream_iterator( std::cout, "" ) );

I do not think you need this ability in a real life for cycle
iterator.

>
> Removed make_cycle with container argument.

I think creating cycle iterator for container would be the most
frequently used feature. But we can't pass container by value. So we
need to choose between const/mutable reference. After some
consideration I would probably choose const version now.

[...]
>
> Thomas
>

Gennadiy


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