Boost logo

Boost :

Subject: Re: [boost] rationale for aux_/vector0.hpp (was Re: [mpl][docs]why use list?
From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2009-04-06 01:23:16


On Sun, 29 Mar 2009 16:33:14 -0500, Larry Evans
<cppljevans_at_[hidden]> wrote:

> On 03/29/09 14:35, Steven Watanabe wrote:
> [snip]
>
>>> what's the rationale for vector0::lower_bound_::value == 32768
>> push_front decreases lower_bound_, and the lower_bound_ needs to
>> stay positive. the lower_bound_ in vector zero needs to be fairly high
>> to avoid problems. There is no reason why it has to be exactly 32768.
>
> OK. That's what I initially thought, i.e. it has to be positive;
> however, I'm wondering if that's true. What would happen if it
> it were zero? I know the v_item<_,_1> uses prior; however,
> I don't see how that would cause a problem. After all,
> the static item_ function only requires some type which
> just happens to be, in the current implementation, an instance
> of long_, but why couldn't there be an item_<long_<-1> >?
> Is there some other piece of code that requires a positive index_?

This might be a historic artifact at this point. It's easy enough to
verify: just change it to go negative and run the tests :).

>> at_front indicates whether to use push_front or push_back. It's
>> really a bool not an int.
>>
>
> I understand; however, I really just wanted to know why the
> items could be added from the front instead of the back.

It makes vector a more versatile sequence at almost no cost, thus
helping to avoid proliferation of different types of sequences user has
to chose from.

HTH,

-- 
Aleksey Gurtovoy
MetaCommunications Engineering

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