为什么复制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