Boost logo

Boost Users :

Subject: Re: [Boost-users] fusion struct adapt macro, construct the struct from a fusion vector
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-01-18 21:25:37


> I am trying to write code that is as independent of the struct as
> possible.
> The first thing that comes to my mind for the ctor is
>
> struct params {
> ...// there are 7 members, in the 100 or so different structs I will
> have,
> max 20 members maybe
> template <typename T1, ... typename T7>
> params(const fusion::vector<T1,...T7>& v);
> };
>
> This probably isn't what you meant.
> How to generalize it to any fusion sequence?
> Is it possible to generalize the number of template args?

What about:

  template <typename Seq>
  params(Seq const& seq,
    typename boost::enable_if<
        fusion::traits::is_sequence<Seq>
>::type* = NULL);

?

Regards Hartmut

---------------
Meet me at BoostCon
www.boostcon.com


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