From: Drazen DOTLIC (Drazen.Dotlic_at_[hidden])
Date: 2004-01-12 08:25:56
While trying the following code (vc7.1)
boost::variant<std::string, long, bool> v1 = "Test";
I noticed that v1 was initialized to be bool and not string. Considering
documentation for variant, there should be nothing in variant code that
would cause something like this, so it is either C++ standard library
implementation or the compiler I guess.
String implementation that comes with vc7.1 does not have constructor
that accepts const char (that's type of "Test") so compiler decides
that conversion to bool is better match than conversion to const char*
and then initializing string - is this correct? If this is standard
behavior, is there a way to overcome it in variant library itself -
should I want this even (in other words, any undesirable side effects)?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk