Boost logo

Boost Users :

From: Jiri Palecek (jpalecek_at_[hidden])
Date: 2008-03-28 11:54:05


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net