Boost logo

Boost :

Subject: [boost] rationale for aux_/vector0.hpp (was Re: [mpl][docs]why use list?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-03-29 17:33:14


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_?

[snip]

>> However, if the items were added from the head, then at_front=1 could
>> be used. The reason that would be desirable is that it enables the
>> variadic template compiler to used to simplify the mpl::vector
>> implementation, as shown here:
>>
>> TinyURL.com/cof5br
> 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.
This would allow the least change to the code in order to
use a variadic template compiler, AFAICT.

Thanks again Steven,

-Larry


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