草庐IT

模棱两可

全部标签

c++ - 为什么即使给定了模板参数,ptr_fun 也会发现这种模棱两可的情况?

所以,这里有一些基本代码可以说明我的问题:#includeintfunc(intx){returnx;}intfunc(intx,inty){returnx+y;}intmain(){std::ptr_fun(func);}对于具有不同数量参数的函数,我们有2个重载。然后我尝试在仿函数中转换单参数版本。当然,我遇到了以下错误:test.cc:Infunction'intmain()':test.cc:13:29:error:callofoverloaded'ptr_fun()'isambiguous/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/inclu

tablenameattribute.tablenameattribute(String)之间的模棱两可的错误

我只是升级了.Netv4.0至4.6.1并最终在应用程序中使用的SQL相关属性(tableName,primarykey,列)的歧义错误。我试图弄清楚哪个DLL导致此错误。我正在看到错误tablenameattribute.tablenameattribute(字符串)首要的关键。columnAttribute...等我想知道哪个dll我必须删除看答案歧义是在实体框架和system.com.ponentmodel.dataannotations之间

c++ - 显然模棱两可的调用不会导致 GCC 上的编译错误

令我惊讶的是,GCC没有认为以下程序中对foo()的调用不明确:#includestructB1{boolfoo(bool){returntrue;}};structB2{boolfoo(bool){returnfalse;}};structC:publicB1,publicB2{usingB1::foo;usingB2::foo;};intmain(){Cc;//Compilesandprints`true`onGCC4.7.2andGCC4.8.0(beta);//doesnotcompileonClang3.2andICC13.0.1;std::cout上面的函数调用在GCC4.

c++ - 为什么覆盖全局新运算符和类特定运算符不是模棱两可的行为?

考虑以下代码:classFoo{public://class-specificFoooperator+(Foo&rhs){returnFoo();//Justreturnatemporary}void*operatornew(size_tsd){returnmalloc(sd);}};//globalFoooperator+(Foo&lhs,Foo&rhs){returnFoo();}void*operatornew(size_tsd){returnmalloc(sd);}此代码无法编译,声明调用不明确,因为它匹配两个运算符:Fooa,b;a+b;但是这个带有new运算符的编译得很好,

c++ - 可变参数模板 - 模棱两可的调用

以下代码在gcc4.7.2和MSVC-11.0中编译:templatevoidfoo(Tbar){}templatevoidfoo(Tbar,Args...args){}intmain(){foo(0);//OK}为什么?我认为这一定是模棱两可的电话:ISO/IEC14882:201114.5.6.2Partialorderingoffunctiontemplates[temp.func.order]5...[Example:templatevoidf(T,U...);//#1templatevoidf(T);//#2templatevoidg(T*,U...);//#3templat

ios - 类型 ... 模棱两可,没有更多上下文

关于将iOS应用程序迁移到Swift3.0的过程。这是我面临的一个问题。先上相关代码:letcalendar=NSCalendar.current,calendCompo=calendar.components([.Year,.Month,.Day,.Hour,.Minute,.Second],fromDate:NSDate())第二个问题:我收到此错误消息,第二行:Typeofexpressionisambiguouswithoutmorecontext我也试过这段代码:letcalendar=NSCalendar.current,calendCompo=calendar.compo

swift - 使用 PromiseKit 时模棱两可地使用 recover error

在处理执行promise时可能抛出的错误时使用恢复时遇到奇怪的错误。如果recoverblock中有多个语句,则将.recover与.then链接会导致编译。在recoverblock中有单个语句可以工作并且单独使用recover(promise.recover{}而没有then可以工作)附上单语句恢复(有效)和多语句恢复(抛出编译错误并显示消息:模棱两可使用recover(on:__:))的屏幕截图任何关于如何调试它的帮助将不胜感激。 最佳答案 recover可以返回一个Promise。如果您的恢复block中只有1条语句,那么编

Swift 模棱两可地使用 sum()

我有以下扩展:protocolAddable{init()func+(lhs:Self,rhs:Self)->Self}extensionInt:Addable{}extensionDouble:Addable{}extensionSequenceTypewhereGenerator.Element:Addable{funcsum()->Generator.Element{returnreduce(Generator.Element()){$0+$1}}}我尝试在单元测试中使用:functestThatArrayOfDoublesCanCalculateTheSumOfAllEleme

swift - 模棱两可地使用 observe firebase DB

我真的不知道哪里出了问题?我正在尝试从firebaseSettings节点加载一些设置数据。其他功能中其他节点的相同代码有效,但这个代码不明确。为什么?varref:FIRDatabaseReference!//GlobalvariableoverridefuncviewDidLoad(){super.viewDidLoad()self.mapView.delegate=selfifCLLocationManager.locationServicesEnabled(){locationManager.delegate=selflocationManager.desiredAccurac

swift - 如何调用模棱两可的方法?

给定这段代码extensionArray{funcfilter(includeElement:(T)->Bool)->T[]{varret=T[]()foreinself{ifincludeElement(e){ret+=e}}returnret}}vara=[1,2]varb=a.filter(){iinprint(i);returntrue}编译失败,提示错误error:ambiguoususeof'filter'varb=a.filter(){iinprint(i);returntrue}^Swift.Array:84:8:note:foundthiscandidatefuncf