Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2004-04-14 02:44:37

On Tue, 13 Apr 2004 15:08:35 +0200, "Pavel Vozenilek"
<pavel_vozenilek_at_[hidden]> wrote:

>"Gennaro Prota" <gennaro_prota_at_[hidden]> wrote
>> Hmm. Here's an extremely condensed (not exhaustive) summary of
>> changes, future directions and open issues.
>Off topic:

It isn't off topic, I guess :)

> what is your opinion on being able to use
>negative indexes in operator[]?

Just for the case index == -1 or in general?

>Like bs[-1] would return the last value stored?
>(Or with different syntax bs[boost.end - 1].)

So that, in general,

b[i] with i<0 would give: b[sz - ((-i) % sz)] where sz = b.size()?
[Note that this gives undefined behavior when the absolute value of i
is a multiple of sz] Is there a motivating case for this? My fear is
that it slows down operator[].

>Such feature has been asked for with circular_buffer.

Could you please point me to a post that describes the semantics? I'm
not following the circular_buffer review, unfortunately.



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