Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-04-14 11:23:05


"Gennaro Prota" <gennaro_prota_at_[hidden]> wrote

(snip about negative index in operator[] )
> 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[].
>
 b[i] with i<0 would give: b[b.size() - (-i)]

Some language (forgot name) provides such feature.

I feel unless it is adopted by all random access
containers in Boost it should not be implemented
for single case.

/Pavel


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