On Dec 1, 2007 9:22 AM, Germán Diago <germandiago@gmail.com> wrote:
Hello. I'm trying to build a library and I'm doing heavy use of boost mpl and fusion libraries. I'd like to know a way to fill a boost::fusion::vector<> with the types contained in a boost::mpl::vector. Anyone knows how to do this? The code I have so far:
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10> struct Func {
//This is the initial sequence typedef typename boost::mpl::vector<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> sequence;
//The sequence without NullTypes typedef typename boost::mpl::filter_view<sequence, boost::mpl::not_<boost::is_same<NullType, boost::mpl::_1> > >::type validsequence;
//The vector I want to fill with validsequence. Note that this is a fusion vector, not a mpl vector typedef boost::fusion::vector<> voidvector;
/***************PROBLEM HERE*******************/ //I want to copy validsequence types into voidvector typedef typename somewaytocopy::type type; };
Hi Germán, I think the following might work (untested): #include <boost/fusion/include/mpl.hpp> #include <boost/fusion/include/as_vector.hpp> // ... typedef typename boost::fusion::result_of::as_vector<validsequence>::type fusion_valid_sequence; fusion_valid_sequence fusion_vector; (You can't fill voidvector with the types, since you already made it a fusion::vector<>) HTH, Stjepan