草庐IT

type-equivalence

全部标签

c++ - 类 'is not a template type'

这个错误是什么意思?Generic.h:25:error:'Generic'isnotatemplatetype这里是通用的。templateclassGeneric:publicQObject,publicCFG,publicvirtualEvaluator{Q_OBJECTstd::stringkey_;std::vectorlayouts_;std::vectorstatic_widgets_;std::map>widget_templates_;std::mapwidgets_;inttype_;LCDWrapper*wrapper_;protected:LCDText*lcd

c++ - 如何将 "pointer to pointer type"转换为 const?

用下面的代码voidTestF(constdouble**testv){;}voidcallTest(){double**test;TestF(test);}我明白了:'TestF':cannotconvertparameter1from'double**'to'constdouble**'我不明白为什么。为什么test不能被无声地转换为constdouble**?我为什么要明确地这样做?我知道TestF(const_cast(test))使我的代码正确,但我觉得这应该是不必要的。我缺少一些关于const的关键概念吗? 最佳答案 该

c++ - 如何将 "pointer to pointer type"转换为 const?

用下面的代码voidTestF(constdouble**testv){;}voidcallTest(){double**test;TestF(test);}我明白了:'TestF':cannotconvertparameter1from'double**'to'constdouble**'我不明白为什么。为什么test不能被无声地转换为constdouble**?我为什么要明确地这样做?我知道TestF(const_cast(test))使我的代码正确,但我觉得这应该是不必要的。我缺少一些关于const的关键概念吗? 最佳答案 该

c++ - _Block_Type_Is_Valid (pHead->nBlockUse) 错误

我一直在从事一个新项目,但遇到了一个我不知道为什么会失败的问题。当我执行此行删除textY时,给我错误_Block_Type_Is_Valid(pHead->nBlockUse)。那我做错了什么?这是源代码:Text.h#ifndefTEXT_H#defineTEXT_Htypedefboost::shared_ptrFontPtr;classText{public:Text(FontPtrfont,char*text){str=newchar[35];this->font=font;str=text;}Text(constText&cSource);Text&operator=(co

c++ - _Block_Type_Is_Valid (pHead->nBlockUse) 错误

我一直在从事一个新项目,但遇到了一个我不知道为什么会失败的问题。当我执行此行删除textY时,给我错误_Block_Type_Is_Valid(pHead->nBlockUse)。那我做错了什么?这是源代码:Text.h#ifndefTEXT_H#defineTEXT_Htypedefboost::shared_ptrFontPtr;classText{public:Text(FontPtrfont,char*text){str=newchar[35];this->font=font;str=text;}Text(constText&cSource);Text&operator=(co

c++ - C++17 中已弃用的 std::is_literal_type

根据cppreference,性状std::is_literal_type在C++17中已弃用。问题是为什么和首选替代品是什么以供将来检查类型是否为literaltype. 最佳答案 AsstatedinP0174:Theis_literaltypetraitoffersnegligiblevaluetogenericcode,aswhatisreallyneededistheabilitytoknowthataspecificconstructionwouldproduceconstantinitialization.Thecor

c++ - C++17 中已弃用的 std::is_literal_type

根据cppreference,性状std::is_literal_type在C++17中已弃用。问题是为什么和首选替代品是什么以供将来检查类型是否为literaltype. 最佳答案 AsstatedinP0174:Theis_literaltypetraitoffersnegligiblevaluetogenericcode,aswhatisreallyneededistheabilitytoknowthataspecificconstructionwouldproduceconstantinitialization.Thecor

C++。错误 : void is not a pointer-to-object type

我有一个C++程序:structarguments{inta,b,c;arguments():a(3),b(6),c(9){}};classtest_class{public:void*member_func(void*args){argumentsvars=(arguments*)(*args);//error:voidisnota//pointer-to-objecttypestd::cout编译时会报错:error:‘void*’isnotapointer-to-objecttype有人可以解释我做错了什么来产生这个错误吗? 最佳答案

C++。错误 : void is not a pointer-to-object type

我有一个C++程序:structarguments{inta,b,c;arguments():a(3),b(6),c(9){}};classtest_class{public:void*member_func(void*args){argumentsvars=(arguments*)(*args);//error:voidisnota//pointer-to-objecttypestd::cout编译时会报错:error:‘void*’isnotapointer-to-objecttype有人可以解释我做错了什么来产生这个错误吗? 最佳答案

c++ - 为什么 'declval' 指定为 'add_rvalue_reference<T>::type' 而不是 'T&&' ?

§20.2.4[declval]templatetypenameadd_rvalue_reference::typedeclval()noexcept;//asunevaluatedoperand为什么使用add_rvalue_reference在这里?来自§20.9.7.2[meta.trans.ref]在add_rvalue_reference:IfTnamesanobjectorfunctiontypethenthemembertypedeftypeshallnameT&&;otherwise,typeshallnameT.[Note:Thisrulereflectsthesem