Boost logo

Boost :

Subject: Re: [boost] [mpl][docs]why use list?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-03-27 11:43:43


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. That's because,
> from:
>
>
> https://svn.boost.org/trac/boost/browser/trunk/boost/mpl/vector/aux_/preprocessed/typeof_based/vector10.hpp
>
>
> containing:
>
> template<
> 39 typename T0, typename T1, typename T2
> 40 >
> 41 struct vector3
> 42 : v_item<
> 43 T2
> 44 , vector2< T0,T1 >
> 45 >
> 46 {
> 47 typedef vector3 type;
> 48 };
>
> it appears that vector would have a memoization advantage for idential
> heads. For instance:
>
> vector<T0,T1,T2_1> vs vector<T0,T1,T2_2>
>
> from the above vector3 code:
>
> v_item<T2_1,vector2<T0,T1> > vs v_item<T2_2,vector2<T0,T1> >
>
> 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.

In Christ,
Steven Watanabe


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