Why does boost::variant not provide operator !=
boost-variant, c++
Solution
I think it's just not added to the library. The Boost.Operators won't really help, because either variant would have been derived from boost::operator::equality_comparable. David Pierre is right to say you can use that, but your response is correct too, that the new operator!= won't be found by ADL, so you'll need a using operator.
I'd ask this on the boost-users mailing list.
Edit from @AFoglia's comment:
Seven months later, and I'm studying Boost.Variant, and I stumble over this better explanation of the omission lists.
http://boost.org/Archives/boost/2006/06/105895.php
`operator==` calls `operator==` for the actual class currently in the variant. Likewise calling `operator!=` should also call `operator!=` of the class. (Because, theoretically, a class can be defined so `a!=b` is not the same as `!(a==b)`.) So that would add another requirement that the classes in the variant have an `operator!=`. (There is a debate over whether you can make this assumption in the mailing list thread.)
Problem
Given two identical `boost::variant` instances `a` and `b`, the expression `( a == b )` is permitted. However `( a != b )` seems to be undefined. Why is this?