----- Original Message ----- From: "Hicham Mouline" <hicham@mouline.org> To: <boost-users@lists.boost.org> Sent: Tuesday, January 19, 2010 4:22 PM Subject: Re: [Boost-users] fusion struct adapt macro,construct the struct from a fusion vector
What about:
template <typename Seq> params(Seq const& seq, typename boost::enable_if< fusion::traits::is_sequence<Seq>
::type* = NULL);
?
Fantastic.
Here is the code I have (plz see below), but it seems there are issues with const-ness that I don't understand.
Following my previous attempt, replacing the functor applied by foreach to the zipped sequence by: struct assignelt { template <typename T> void operator()( const vector2<const T&, const T&>& seqpairs ) const { typedef vector2<const T&, const T&> pair_t; const_cast<T&>(at_c<0, const pair_t>(seqpairs)) = at_c<1, const pair_t>(seqpairs); } }; works. I can now construct my struct params from an equivalent fusion sequence. This constructor is identical for all my params struct. I have structs params1 to params100 Is there a way to factorise this ctor and not repeat its definition in the 100 struct params? Is this possible with a base struct templated on the derived struct? rds,