Boost logo

Boost Users :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-04-16 14:43:27


Debian User <greened_at_[hidden]> wrote:
> Suppose I have a number of types that each have a
> "value" enum, much like MPL's constant classes.
> Now suppose that I want to construct a
> runtime-indexable array of those values,
> according to the position of each type in an
> MPL vector.
>
> For example:
>
> int values[3];
>
> typedef boost::mpl::vector_c<int,10, 11, 12> values;
>
> typedef some_magic_metafunction<values>::type runtime_function;
>
> // values[0] = 10, values[1] = 11, values[2] = 12
> runtime_function::fill_array(values);

[...]

Please see http://tinyurl.com/3ccex for a documented example and
http://tinyurl.com/2q7hl for the compliable code along the lines
of what you need.

HTH,

--
Aleksey Gurtovoy
MetaCommunications Engineering

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net