Boost logo

Boost :

Subject: Re: [boost] [mpl][docs]why use list?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-03-29 14:10:39


On 03/27/09 10:43, Steven Watanabe wrote:
> AMDG
>
> Larry Evans wrote:
>> After viewing the code some more, I'm wondering if the memoization is
>> not also possible with vectors with identical tails.
[snip]
>> So, maybe list has an advantage for identical tails but vector has an
>> advantage for identical heads?
>
> No. Take a look at how the iterators for vector work.
>
> template<
> typename Vector
> , BOOST_MPL_AUX_NTTP_DECL(long, n_)
> >
> struct v_iter;
>
> Iterators into different vectors are always distinct.

Ah! Thanks.

Now, on a related matter,

what's the rationale for vector0::lower_bound_::value == 32768

as shown here:

 
https://svn.boost.org/trac/boost/browser/trunk/boost/mpl/vector/aux_/vector0.hpp#L35

and what's the rationale for at_front=0 here:

 
https://svn.boost.org/trac/boost/browser/trunk/boost/mpl/vector/aux_/item.hpp#L31

The only reason, AFAICT, for the at_front value is that the vectorI
specializations here:

 
https://svn.boost.org/trac/boost/browser/trunk/boost/mpl/vector/aux_/preprocessed/typeof_based

for some reason add items starting from the tail, as shown at:

 
https://svn.boost.org/trac/boost/browser/trunk/boost/mpl/vector/aux_/preprocessed/typeof_based/vector10.hpp#L43

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

The reason I'd like to know the vector0::lower_bound_::value rationale
is I'd like to add that to the in source documentation. However, as
you can see from looking at the current mpl/vector/aux_/vector0.hpp
source file, I can't figure out a good reason for 32768.

Thanks very much for your help, Steven.

-regards,
Larry


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