EDIT AN ERROR STATING A BOOST: APPLY_VISITOR
You can create a binary visitor for your option, and then use boost :: apply_visitor to create a comparator for your map:
class variant_less_than
: public boost::static_visitor<bool>
{
public:
template <typename T, typename U>
bool operator()( const T & lhs, const U & rhs ) const
{
}
template <typename T>
bool operator()( const T & lhs, const T & rhs ) const
{
}
};
You will probably have to overload operator()for each possible pair of types, as indicated in the use of the template operator(const T &, const U &). Then you need to declare your card as follows:
class real_less_than
{
public:
template<typename T>
bool operator()(const T &lhs, const T &rhs)
{
return boost::apply_visitor(variant_less_than(), lhs, rhs);
}
};
std::map<boost::variant<T, U, V>, ValueType, real_less_than> myMap;
: operator<() boost::variant, :
bool operator<(const variant &rhs) const
{
if(which() == rhs.which())
else
return which() < rhs.which();
}
, , .