C++ boost::带有字符串和bool的变量不';结构中的字符串不能正确匹配
在以下示例中:C++ boost::带有字符串和bool的变量不';结构中的字符串不能正确匹配,c++,boost,variant,C++,Boost,Variant,在以下示例中: boost::variant<double, std::string, bool> testString("this string"); std::string s1 = boost::get<std::string>(testString); 它是2的值,因此在施工期间它与bool明显匹配。这一点可以通过以下事实得到进一步证实: boost::variant<double, std::string> testString("this str
boost::variant<double, std::string, bool> testString("this string");
std::string s1 = boost::get<std::string>(testString);
它是2
的值,因此在施工期间它与bool明显匹配。这一点可以通过以下事实得到进一步证实:
boost::variant<double, std::string> testString("this string"); // bool is removed
boost::variant testString(“此字符串”);//布尔被移除
为什么boost变量将构造中的“此字符串”
与bool
匹配,而不是与字符串匹配?
boost::variant<double, std::string> testString("this string"); // bool is removed