
28 Mar
2008
28 Mar
'08
3:54 p.m.
Hello, is there some deep reason why comparing variant to a nonvariant is disabled? For example: variant<int, string> v=1; assert(v==1); // doesn't compile The problem is that there are overloads for anything else than a variant, which explicitely fail to compile (via static_assert and other means). If they weren't there, everything would work (the comparison would invoke conversion constructor, and then normal variant/variant comparison. Another problem is that variant includes the == operator, but not !=, even though this could be easily achieved with boost::operators. I can send patches if that would help. Regards Jiri Palecek