Closed mahdy-asady closed 4 years ago
variant<int, double, string, bool> a = "Test";
is ambiguous, because the compiler has two equally good conversions available:
a) const char*
to bool
(implicit pointer-to-bool conversion)
b) const char*
to std::string
(using std::string conversion constructor)
You need to disambiguate it yourself, e.g.:
variant<int, double, string, bool> a = string("Test");
i cant use below code: variant<int, double, string, bool> a = "Test";
but when i remove bool variable type it works fine!