Boost logo

Boost Users :

From: Hicham Mouline (hicham_at_[hidden])
Date: 2008-05-31 08:16:27


Thank you,
Trying to define the variant, I have:

typedef boost::mpl::vector<> variant_template_arguments;
typedef boost::mpl::vector<constant, linear, polynomial, cubic_spline>
interpolator_types;
typedef boost::mpl::vector<simpson> integrator_types;

I have a curve template
 template <typename intepolator, typename extrapolator, typename integrator>
curve;
I want to generate the list of all curves by iterating the template args in
the vector<>
and inserting these curves in variant_template_arguments

to finally

typedef make_variant_over< variant_template_arguments >::type
my_wanted_variant;

How should I do the iteration/insertion in variant_template_arguments?

Rds,

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Steven Watanabe
Sent: 29 May 2008 23:53
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] variant<> number of template arguments

AMDG

Hicham Mouline wrote:
>
> Question1: is the maximum number of variant<> arguments extendable?
>

The easiest way is to use make_variant_over which takes an MPL sequence.

> Question2: Below, some of the variants I have are full template specs.
>
> Is there a way to write the variant<> typedef with templates instead
> and have
>
> the operator() of the static visitor a template member.
>
>
>

I'm not sure what you want. If the members of the variant have a common
interface, (For example if they all have a nested integer constant
called value)
Then you can make the static visitor operator() a template and use this
common interface.

In Christ,
Steven Watanabe


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