传递boost :: variant派生类时出错

时间:2018-04-26 15:53:10

标签: c++ c++11 boost boost-variant

为什么复制foo实例会产生错误: error: call of overloaded 'convert_construct(foo&, long int)' is ambiguous

#include <iostream>
#include <string>
#include <boost/variant.hpp>

struct foo : public boost::variant<int, std::string>
{
    using boost::variant<int, std::string>::variant;
};

int main()
{
  foo f(111);
  // auto g = f;  // ERROR -> call of overloaded 'convert_construct(foo&, long int)' is ambiguous
}

实例:cpp.sh/7f3xy

0 个答案:

没有答案