
la> [snip]
Could you post a test driver showing the problem. I'd like to see how:
In rough (but working) code: class CVisitBinary : public static_visitor<bool> { public: template<typename T, typename U> bool operator()(const T&, const U&) const { return false; } template<typename T> bool operator()(const T&, const T&) const { return true; } }; template<typename Typelist, typename ElementType1, typename ElementType2> void TestVariantBinary() { typedef Layout::make_variant_over<Typelist>::type variant_t; variant_t v1_1(boost::shared_ptr<ElementType1>(new ElementType1)); variant_t v1_2(boost::shared_ptr<ElementType1>(new ElementType1)); variant_t v2_1(boost::shared_ptr<ElementType2>(new ElementType2)); BOOST_CHECK(apply_visitor(CVisitBinary(), v1_1, v1_2)); //Same type BOOST_CHECK(apply_visitor(CVisitBinary(), v1_1, v1_1)); //Same type, same instance BOOST_CHECK(!apply_visitor(CVisitBinary(), v1_1, v2_1)); //Different types } //Generate 200 types (class C1, C2, ... C200) #define BOOST_PP_LOCAL_MACRO(n) \ class BOOST_PP_CAT(I, n) \ { \ public: \ }; \ \ class BOOST_PP_CAT(C, n) \ : public BOOST_PP_CAT(I, n) \ { \ public: \ int i; \ }; #define BOOST_PP_LOCAL_LIMITS (0, 200) #include BOOST_PP_LOCAL_ITERATE() //Generate mpl sequences #define SHARED_PTR_C(z, n, data) boost::shared_ptr<BOOST_PP_CAT(C, n)> #define SHARED_PTR_I(z, n, data) boost::shared_ptr<BOOST_PP_CAT(I, n)> typedef boost::mpl::vector10<BOOST_PP_ENUM(10, SHARED_PTR_C, 0)> MplVectorC10_t; void test() { TestVariantBinary<MplVectorC10_t, C3, C4>(); //2 phase visitation giving 100 paths }