Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-08-27 20:46:33


Arkadiy Vertleyb writes:
> Sorry to repeat this question, but I think I am missing somehing here:
>
> Do I understand correctly that it's not possible in the current
> version of MPL to use mpl::vector of a size larger than 50?

It is possible. As I tried to explain in my previous reply, you can
pre-generate the coressponding headers up to whatever limit you
choose. You can also generate the sequence "on the fly", although
that's less efficient.

>
> If this is not correct, what exactly do I have to do to use, for
> example, mpl::vector97<...>?

    #include "boost/mpl/vector/vector50.hpp"
    #include "boost/mpl/aux_/config/vector.hpp"
    #include "boost/mpl/aux_/config/ctps.hpp"
    #include "boost/preprocessor/iterate.hpp"
    #include "boost/config.hpp"

    namespace boost { namespace mpl {
    #define BOOST_PP_ITERATION_PARAMS_1 \
        (3,(51, 100, "boost/mpl/vector/aux_/numbered.hpp"))
    #include BOOST_PP_ITERATE()
    }}

>
> If this _is_ correct, I would like to make a feature request for it
> to be increased, since the limit of 50 doesnt seem to be high enough
> (I am making this statement in conjunction with the need of my
> typeof emulation lib, but I am kind of surprized this question
> hasn't yet popped up in other contexts, or has it?).

We are using sequences of ~70 elements here at work (mostly in context
of FSMs), but then we simply pre-generate them locally. Increasing the
default limit to, let's say, 100 elements means plus ~120 KB to the
size of the distribution, and I'm not sure the need is widespread
enough to make everybody pay for it.

> In particular, isn't it possible to just get it fully controlled by
> BOOST_MPL_LIMIT_VECTOR_SIZE without any limitations whatsoever?

Once again, tweaking BOOST_MPL_LIMIT_VECTOR_SIZE is a dubious
practice. You can get as long of a sequence as you want with the
technique demostrated in the example above, with a caveat that it's
going to be less efficient than using pre-generated headers.

-- 
Aleksey Gurtovoy
MetaCommunications Engineering

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