Boost logo

Boost :

From: Richard Peters (r.a.peters_at_[hidden])
Date: 2005-03-04 08:53:43


I encountered a problem using a sequence obtained by mpl::joint_view with
make_variant_over. While I can make a variant over a sequence of types, I
can't make the variant over two typesequences joined together with
joint_view. I am really new with mpl, so I might just have done something
really wrong. The program is below, the line commented out produces lots of
errors when uncommented. Is this a problem in either the variant or the mpl
library, or did I just do something wrong?


Richard Peters

#include <boost/mpl/vector.hpp>
#include <boost/mpl/joint_view.hpp>
#include <boost/variant.hpp>

namespace mpl { using namespace boost::mpl; }

struct a {};
struct b {};

int main()
    typedef mpl::vector<a> list1;
    typedef mpl::vector<b> list2;
    typedef mpl::joint_view<list1, list2>::type joint_list;

    typedef boost::make_variant_over<list1>::type variant_type1;
    typedef boost::make_variant_over<joint_list>::type variant_type2;

    a x;
    variant_type1 y(x);
    //variant_type2 z(x); // doesn't compile

Boost list run by bdawes at, gregod at, cpdaniel at, john at