Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误:‘;的不明确重载;操作员<<’;在C+中使用模板时+; 用C++中的这个模板重载运算符_C++_Templates_G++_Llvm - Fatal编程技术网

错误:‘;的不明确重载;操作员<<’;在C+中使用模板时+; 用C++中的这个模板重载运算符

错误:‘;的不明确重载;操作员<<’;在C+中使用模板时+; 用C++中的这个模板重载运算符,c++,templates,g++,llvm,C++,Templates,G++,Llvm,如果你在代码中有这个地方, long x = 1; env << x; 其中,env是一个Envir,不知何故,n是一种可以强制转换为long或无符号long的类型,但它不是任何类型的ostream::operator,我们可以获得更多信息。例如,您在哪里声明了这个模板,涉及的不同元素的类型是什么?发布整个错误。在这个模板实例化中,我们看不到t是什么。 error: ambiguous overload for ‘operator<<’ in ‘((cEnvir*)th

如果你在代码中有这个地方,

long x = 1;
env << x;

其中,
env
是一个
Envir
,不知何故,
n
是一种可以强制转换为
long
无符号long
的类型,但它不是任何类型的
ostream::operator,我们可以获得更多信息。例如,您在哪里声明了这个模板,涉及的不同元素的类型是什么?发布整个错误。在这个模板实例化中,我们看不到
t
是什么。
error: ambiguous overload for ‘operator<<’ in ‘((cEnvir*)this)->cEnvir::out << t’
/usr/include/c++/4.2.1/ostream:169: note: candidates are: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char, _Traits = std::char_traits<char>] <near match>

/usr/include/c++/4.2.1/ostream:173: note:                 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char, _Traits = std::char_traits<char>]

...
long x = 1;
env << x;
env << n;