草庐IT

ambiguous

全部标签

c++ - 为什么 GCC 不能消除多个继承函数的歧义(但 clang 可以)?

这个问题在这里已经有了答案:关闭11年前.PossibleDuplicate:Whydomultiple-inheritedfunctionswithsamenamebutdifferentsignaturesnotgettreatedasoverloadedfunctions?使用g++4.6.1无法在指定位置编译:enumEa{Ea0};enumEb{Eb0};structSa{voidoperator()(Ea){}};structSb{voidoperator()(Eb){}};structSbroken:Sa,Sb{};structSworks{voidoperator()(

c++ - 为什么 GCC 不能消除多个继承函数的歧义(但 clang 可以)?

这个问题在这里已经有了答案:关闭11年前.PossibleDuplicate:Whydomultiple-inheritedfunctionswithsamenamebutdifferentsignaturesnotgettreatedasoverloadedfunctions?使用g++4.6.1无法在指定位置编译:enumEa{Ea0};enumEb{Eb0};structSa{voidoperator()(Ea){}};structSb{voidoperator()(Eb){}};structSbroken:Sa,Sb{};structSworks{voidoperator()(

C++ Cout & Cin & 系统 "Ambiguous"

关闭。这个问题需要detailsorclarity.它目前不接受答案。想要改进这个问题吗?通过editingthispost添加详细信息并澄清问题.关闭8年前。Improvethisquestion我只是在C++中编程,突然间所有的“cout”和“cin”都是错误和“模棱两可的”。包括系统。我不知道为什么会这样。一切都很好,我在同一个程序中编写了大约2个小时,然后它就……发生了。编辑我仍然可以无错误地运行程序,但它们在文本中显示为错误,即红色涂鸦线。发生了什么?我正在使用VisualStudio2013IDE,无论它附带什么。#include#include#include#inclu

C++ Cout & Cin & 系统 "Ambiguous"

关闭。这个问题需要detailsorclarity.它目前不接受答案。想要改进这个问题吗?通过editingthispost添加详细信息并澄清问题.关闭8年前。Improvethisquestion我只是在C++中编程,突然间所有的“cout”和“cin”都是错误和“模棱两可的”。包括系统。我不知道为什么会这样。一切都很好,我在同一个程序中编写了大约2个小时,然后它就……发生了。编辑我仍然可以无错误地运行程序,但它们在文本中显示为错误,即红色涂鸦线。发生了什么?我正在使用VisualStudio2013IDE,无论它附带什么。#include#include#include#inclu

c++ - 为什么隐式转换对于非原始类型不模棱两可?

给定一个具有多个隐式转换函数(非显式构造函数和转换运算符)的简单类模板,如下例所示:templateclassFoo{private:Tm_value;public:Foo();Foo(constT&value):m_value(value){}operatorT()const{returnm_value;}booloperator==(constFoo&other)const{returnm_value==other.m_value;}};structBar{boolm;booloperator==(constBar&other)const{returnfalse;}};intmai

c++ - 为什么隐式转换对于非原始类型不模棱两可?

给定一个具有多个隐式转换函数(非显式构造函数和转换运算符)的简单类模板,如下例所示:templateclassFoo{private:Tm_value;public:Foo();Foo(constT&value):m_value(value){}operatorT()const{returnm_value;}booloperator==(constFoo&other)const{returnm_value==other.m_value;}};structBar{boolm;booloperator==(constBar&other)const{returnfalse;}};intmai

c++ - 为什么这个涉及重载运算符和隐式转换的 C++ 表达式不明确?

operatorbool打破operator的使用在下面的例子中。谁能解释为什么bool在if(a中同样相关表达式作为具体的操作符,是否有变通方法?structFoo{Foo(){}Foo(intx){}operatorbool()const{returnfalse;}friendbooloperator当我编译时,我得到:g++foo.cppfoo.cpp:Infunction'intmain()':foo.cpp:18:11:error:ambiguousoverloadfor'operatorfoo.cpp:8:17:note:candidate:booloperator

c++ - 为什么这个涉及重载运算符和隐式转换的 C++ 表达式不明确?

operatorbool打破operator的使用在下面的例子中。谁能解释为什么bool在if(a中同样相关表达式作为具体的操作符,是否有变通方法?structFoo{Foo(){}Foo(intx){}operatorbool()const{returnfalse;}friendbooloperator当我编译时,我得到:g++foo.cppfoo.cpp:Infunction'intmain()':foo.cpp:18:11:error:ambiguousoverloadfor'operatorfoo.cpp:8:17:note:candidate:booloperator

C++ 编译器错误 : ambiguous call to overloaded function

stringaux;intmaxy,auxx=0;cin>>aux;maxy=(int)sqrt(aux.size());我得到:1>errorC2668:'sqrt':ambiguouscalltooverloadedfunction1>couldbe'longdoublesqrt(longdouble)'1>or'floatsqrt(float)'1>or'doublesqrt(double)'为什么? 最佳答案 string::size()返回size_t,而sqrt在其任何版本中都不接受它。所以编译器必须强制转换,并且不能选

C++ 编译器错误 : ambiguous call to overloaded function

stringaux;intmaxy,auxx=0;cin>>aux;maxy=(int)sqrt(aux.size());我得到:1>errorC2668:'sqrt':ambiguouscalltooverloadedfunction1>couldbe'longdoublesqrt(longdouble)'1>or'floatsqrt(float)'1>or'doublesqrt(double)'为什么? 最佳答案 string::size()返回size_t,而sqrt在其任何版本中都不接受它。所以编译器必须强制转换,并且不能选