|
Boost : |
From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-11-07 02:39:00
Li Lirong wrote:
> I'm using msvc 7.0 and boost_1_29_0. I got this error,
> "boost::mpl::vector : too many template arguments", when the
> number of the template arguments of mpl::vector exceeds 10 no
> matter how I define the BOOST_MPL_LIMIT_VECTOR_SIZE value.
> Is this a bug of the library, limitation of the library or my
> misuse of the library?
It's a documentation omission. By default the library is configured to use
preprocessed headers, and in this mode changing the values of (most of)
configuration macros will have no effect. If you switch the preprocessor
headers off (by commenting out BOOST_MPL_USE_PREPROCESSED_HEADERS define in
"mpl/aux_/config/use_preprocessed.hpp" header), everything will work as
expected (at the price of slightly longer compile times).
Note that usually if you need a longer 'vector' or 'list', it's a better
idea to use the numbered forms, e.g.
#include "boost/mpl/vector/vector40.hpp"
typedef mpl::vector37<.....> types;
Increasing BOOST_MPL_LIMIT_VECTOR_SIZE value will work, but you should
realize that if you do that, then _every other_ translation unit (besides
the one you're making the change for) that includes "mpl/vector.hpp" will
pay for what it most probably doesn't use (in full). When the numbers are
huge (e.g. 50), the difference in compilation times is quite noticeable.
HTH,
Aleksey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk