qicosmos/cosmos

Variant构造时不能自动调用一些转换的bug

lucklove opened this issue · 0 comments

比如,给Variant传入const类型不能自动转换成非const类型,传入const char*不能自动转换成string, 例子如下

        const int i = 0;
        Variant<std::string, int> v1{i};                        //报错
        Variant<std::string, int> v2{"hello"};                  //报错
        Variant<std::string, int> v3{int(i)};                   //正确
        Variant<std::string, int> v4{std::string("world")};     //正确