草庐IT

模棱两可

全部标签

git diff 给出模棱两可的参数错误

我最近从SVN转移到git,并尝试学习git。我需要找到在我的存储库的2个分支之间发生变化的文件。我对此使用以下命令:gitdiffbranch_2..branch_1我收到以下错误:fatal:ambiguousargument'branch_2..branch_1':unknownrevisionorpathnotintheworkingtree.Use'--'toseparatepathsfromrevisions,likethis:'git[...]--[...]'git分支给出以下o/p:gitbranch-a*branch_1master/originremotes/ori

c++ - 模棱两可的赋值运算符

我有两个类,比如说一个代表一个字符串,另一个可以转成字符串:classA{public:A(){}A(constA&){}A(constchar*){}A&operator=(constA&){return*this;}A&operator=(constchar*){return*this;}char*c;};classB{public:operatorconstA&()const{returna;}operatorconstchar*()const{returna.c;}Aa;};现在,如果我这样做了Bx;Ay=x;它触发复制构造函数,它编译得很好。但是如果我这样做了Ay;y=x;它

c++ - 模棱两可的赋值运算符

我有两个类,比如说一个代表一个字符串,另一个可以转成字符串:classA{public:A(){}A(constA&){}A(constchar*){}A&operator=(constA&){return*this;}A&operator=(constchar*){return*this;}char*c;};classB{public:operatorconstA&()const{returna;}operatorconstchar*()const{returna.c;}Aa;};现在,如果我这样做了Bx;Ay=x;它触发复制构造函数,它编译得很好。但是如果我这样做了Ay;y=x;它

c++ - "int (x), 1;"是一个模棱两可的陈述吗?

voidf(intx){int(x),1;}Clang编译它,GCC没有。哪个编译器是正确的? 最佳答案 IMO,[stmt.ambig]中的措辞这一点很清楚:Anexpression-statementwithafunction-styleexplicittypeconversionasitsleftmostsubexpressioncanbeindistinguishablefromadeclarationwherethefirstdeclaratorstartswitha(.Inthosecasesthestatementis

c++ - "int (x), 1;"是一个模棱两可的陈述吗?

voidf(intx){int(x),1;}Clang编译它,GCC没有。哪个编译器是正确的? 最佳答案 IMO,[stmt.ambig]中的措辞这一点很清楚:Anexpression-statementwithafunction-styleexplicittypeconversionasitsleftmostsubexpressioncanbeindistinguishablefromadeclarationwherethefirstdeclaratorstartswitha(.Inthosecasesthestatementis

c++ - GCC 4.9 模棱两可的重载模板特化

我遇到了一个问题,gcc4.9.2(使用-std=c++11)没有编译一段代码,错误消息为callofoverloaded'InsertDataIntoInputMap(int&,boost::shared_ptr&)'isambiguous代码确实使用msvc2013编译#include#include#includestructProxy{typedefstd::mapInputDataMap;inta;};templatevoidInsertDataIntoInputMap(consttypenameC::InputDataMap::key_type&key,constDval)

c++ - GCC 4.9 模棱两可的重载模板特化

我遇到了一个问题,gcc4.9.2(使用-std=c++11)没有编译一段代码,错误消息为callofoverloaded'InsertDataIntoInputMap(int&,boost::shared_ptr&)'isambiguous代码确实使用msvc2013编译#include#include#includestructProxy{typedefstd::mapInputDataMap;inta;};templatevoidInsertDataIntoInputMap(consttypenameC::InputDataMap::key_type&key,constDval)

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++ 11初始化程序具有模棱两可的函数id表达式?

在以下C++11代码中:voidf(int){}voidf(double){}void(*p)(int)=f;有两个功能。第三个f标识符是一个id-expression和p的初始化器。在5.1.1p8[expr.prim.general]/8中它说:Thetypeofthe[id-expression]isthetypeoftheidentifier.Theresultistheentitydenotedbytheidentifier.Theresultisanlvalueiftheentityisafunction,variable,ordatamemberandaprvalueot