草庐IT

explicit

全部标签

c++ - 我们什么时候实际上需要 'explicit xvalues' ?

xvalue的定义如下:—Anxvalue(an“eXpiring”value)alsoreferstoanobject,usuallyneartheendofitslifetime(sothatitsresourcesmaybemoved,forexample).Anxvalueistheresultofcertainkindsofexpressionsinvolvingrvaluereferences(8.3.2).[Example:Theresultofcallingafunctionwhosereturntypeisanrvaluereferenceisanxvalue.—en

c++ - 为什么 `explicit` 与 `virtual` 不兼容?

structA{//errorC2216:'explicit'cannotbeusedwith'virtual'virtualexplicitoperatorbool()const{returntrue;}};structB:A{//errorC2216:'explicit'cannotbeusedwith'override'explicitoperatorbool()constoverride{returnfalse;}};intmain(){if(A()){}if(B()){}}我的编译器是VC++2013RC。为什么explicit与virtual不兼容?原因是什么?

c++ - C-回调函数模板 : explicitly instantiate template

前提我正在使用一个提供以下接口(interface)的C库(来自C++):voidregister_callback(void*f,void*data);voidinvoke_callback();问题现在,我需要将函数模板注册为回调,这给我带来了问题。考虑以下代码:templatevoidmy_callback(void*data){…}intmain(){intft=42;register_callback(reinterpret_cast(&my_callback),&ft);invoke_callback();}这给了我以下链接器错误(在OSX上使用g++(GCC)4.5.1但

c++ - C/C++ 稀有关键字 - register、volatile、extern、explicit

很难说出这里问的是什么。这个问题是模棱两可的、模糊的、不完整的、过于宽泛的或修辞的,无法以目前的形式得到合理的回答。为了帮助澄清这个问题以便可以重新打开它,visitthehelpcenter.关闭11年前。您能否简要介绍一下这4个关键字的用途和原因?我了解google会告诉您的关于register和volatile的基本知识,但想了解更多(只是一个实用的概述)。外部和显式让我有点困惑,因为尽管做了相当低级的嵌入式系统代码,但我从来没有找到自己必须使用它们的理由。再说一次,我可以用谷歌搜索,但我更喜欢专家提供的快速实用的总结,以便牢记在心。 最佳答案

android - Google 应用内计费,升级到 Android L Dev Preview 后出现 IllegalArgumentException : Service Intent must be explicit,

在我升级到AndroidLDevPreview之前,我的应用内结算代码运行良好。现在,当我的应用程序启动时出现此错误。有谁知道导致此问题的L发生了什么变化,或者我应该如何更改我的代码来解决这个问题?android{compileSdkVersion'android-L'buildToolsVersion'20'defaultConfig{minSdkVersion13targetSdkVersion'L'......compile'com.google.android.gms:play-services:5.+'compile'com.android.support:support-v

android - Android Logcat 中的 GC_FOR_MALLOC、GC_EXPLICIT 和其他 GC_* 是什么意思?

如果您查看Android日志,您可能会看到很多此类内容。它们是什么意思,知道这些可能有助于我们更好地分配内存。例子:28470dalvikvmDGC_FOR_MALLOCfreed665objects/239992bytesin71ms28470dalvikvmDGC_FOR_MALLOCfreed673objects/240288bytesin87ms21940dalvikvmDGC_EXPLICITfreed4802objects/185320bytesin78ms28470dalvikvmDGC_FOR_MALLOCfreed666objects/240536bytesin63m

c++ - 错误 : base class constructor must explicitly initialize parent class constructor

我是C++新手。当我尝试编译下面的代码时,我得到了这个错误'child'的构造函数必须显式初始化没有默认构造函数的基类“父级”child::child(inta){这是我的课#includeusingnamespacestd;classParent{public:intx;Parent(inta);intgetX();};Parent::Parent(inta){x=a;}intParent::getX(){returnx;}classChild:publicParent{public:Child(inta);};Child::Child(inta){x=a;}intmain(intn

c++ - 避免构造函数中的隐式转换。 'explicit' 关键字在这里没有帮助

我能够避免使用explicit关键字对构造函数进行隐式转换。所以现在,可以避免像Aa1=10;这样的转换。但我仍然可以初始化Aa1=A(20.2);。如何禁用对象创建,以便仅当我们将整数作为参数传递时才能创建对象,例如Aa1=A(10)?#includeclassA{public:explicitA(inta){num=a;}intnum;};intmain(){Aa1=A(10.0);std::cout 最佳答案 您可以deleteA::A();:structA{explicitA(inta):num(a){}templateA(

javac错误: Class names are only accepted if annotation processing is explicitly requested

我在编译我的java程序时遇到这个错误:error:Classnames,'EnumDevices',areonlyacceptedifannotationprocessingisexplicitlyrequested1error这是java代码(我在Ubuntu上运行它)。importjcuda.CUDA;importjcuda.driver.CUdevprop;importjcuda.driver.types.CUdevice;publicclassEnumDevices{publicstaticvoidmain(Stringargs[]){CUDAcuda=newCUDA(tru

SQL Server 2005 For XML Explicit - 需要帮助格式化

我有一个结构如下的表:位置ID帐号长指南在这里12345长指南在这里54321要传递到另一个存储过程,我需要XML看起来像这样:1234554321到目前为止,我能做的最好的事情就是这样:我正在使用这个SQL语句:SELECT1astag,nullasparent,AccountNumberas'root!1!clientID'FROMLocation.LocationMDAccountWHERElocationid='long-guid-here'FORXMLEXPLICIT到目前为止,我已经查看了theMSDNpage上的文档。,但我没有得到想要的结果。@KG,你的实际上给了我这个