Why can't I visit this custom type with boost::variant?
问题 The following code: #include <boost/variant.hpp> #include <iostream> #include <string> struct A { A() { } ~A() throw() { } A& operator=(A const & rhs) { return *this; } bool operator==(A const & rhs) { return true; } bool operator<(A const & rhs) { return false; } }; std::ostream & operator<<(std::ostream & os, A const & rhs) { os << "A"; return os; } typedef boost::variant<int, std::string, A> message_t; struct dispatcher_t : boost::static_visitor<> { template <typename T> void operator()(T