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
bool operator()(const T&, const U&) const
{
return false;
}
template<typename T>
bool operator()(const T&, const T&) const
{
return true;
}
};
template
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
#define SHARED_PTR_I(z, n, data) boost::shared_ptr
typedef boost::mpl::vector10
MplVectorC10_t;
void test()
{
TestVariantBinary(); //2 phase visitation
giving 100 paths
}