Boost logo

Boost :

Subject: Re: [boost] [mpl][docs]why use list?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-03-23 06:40:25

On 03/21/09 11:31, Steven Watanabe wrote:

Thank you Steven for your response.

> Larry Evans wrote:


>> Is there any reason to prefer list over of vector?
> Usually vector is better. The maximum size of a vector is 50
> on compilers that don't support typeof.

Unfortunately, following the directions on:

I created vector_max.cpp which had an 80 element vector
preceded by this at the top of the file:
-{--cut here--
#include <boost/mpl/vector.hpp>
-}--cut here--

However, compilation resulted in:


/home/evansl/download/gcc/4.4-20090109/install/bin/g++ -c -Wall
-ftemplate-depth-100 -O0 -fno-inline
-I/home/evansl/prog_dev/boost-svn/ro/boost-trunk vector_max.cpp -o
In file included from vector_max.cpp:10:
error: boost/mpl/vector/vector80.hpp: No such file or directory
In file included from


Does anyone know what I might be doing wrong?

> Also, it is possible for memoization to reduce the number of
> template instantiations when iterating over lists with identical
> tails, iterators into distinct vectors always have different types.

Thank you. This is what I needed to know. In summary.

   vector is better for modification at end.

   list may be better for traversal over many lists with similar tails.
   This list advantage is true for compilar using memoization.

This information would have been useful to me while developing the
variadic template version of mpl because, IIRC, I started trying to
emulate the mpl list, but couldn't see any reason to continue. As a
result, the in vault only has the package template which is
used to implement both the vector and list templates.

So, I'd recommend adding this justification for list to the docs.

Boost list run by bdawes at, gregod at, cpdaniel at, john at