草庐IT

type_table

全部标签

c++ - std::common_type 实现

为了了解它是如何工作的,我查看了标题type_traits中std::common_type的libstdc++实现。我不得不承认我并不真正理解它是如何工作的。在这里:///common_typetemplatestructcommon_type;templatestructcommon_type{typedef_Tptype;};templatestructcommon_type{typedefdecltype(true?declval():declval())type;};templatestructcommon_type{typedeftypenamecommon_type::t

c++ - 错误 : no type named 'vector' in namespace 'std'

为什么会这样?error:notypenamed'vector'innamespace'std';didyoumean'hecto'?voidaskForVector(std::vector*vector);#include#includevoidaskForVector(std::vector*vector);intmain(){std::vectorvector;intsize;askForVector(&vector);std::cout>size;vector->resize(size);for(inti=0;i>vector[i];}for(intj:*vector)std:

c++ - <type_traits> 的 is_function_pointer<>

中有这些:is_pointeris_functionis_member_function_pointer但不是这个:is_function_pointer为什么会这样? 最佳答案 [meta.unary.cat]中的特征旨在将每种类型归为一个类别。是void、integral、pointer等等。在这个层面上,pointer-to-function和pointer-to-int没有区别。并注意指向成员的指针不是指针。只不过是英文的谐音而已。它的目的是每个类型都返回true到[meta.unary.cat]中的一个特征。在这种分类中,

c++ - "Template argument for template template parameter must be a class template or type alias template"

templatestructList{};templateclass>structListHelper;templatestructListHelper>{};^/*Error:Templateargumentfortemplatetemplateparametermustbeaclasstemplateortypealiastemplate*/怎么了?我正在使用clang++SVN。 最佳答案 您有一个模板模板参数。您必须传递一个模板作为其参数。您改为将模板实例化作为其参数传递-这是一个具体类,而不是模板(其所有参数均已绑定(bi

c++ - 编译器错误 C4430 : missing type specifier - int assumed

这个问题在这里已经有了答案:Resolvebuilderrorsduetocirculardependencyamongstclasses(12个答案)关闭8年前。我有这个错误:“错误C4430:缺少类型说明符-假定为int。注意:C++不支持default-int”使用此代码示例://A.h#include"B.h"classA{B*b;..};//B.h#include"A.h"classB{A*a;//errorerrorC4430:missingtypespecifier-intassumed.};

c++ - g++ 4.7.1 编译错误 : conflicting types for ‘strsignal’

我正在尝试在Ubuntu12.0432位上从源代码编译g++4.7.1。目前我已经完全做到了:https://askubuntu.com/questions/168947/how-to-upgrade-g-to-4-7-1除了在编译g++4.7.1之前,它要求我“取消设置LIBRARY_PATH”(所以我已经这样做了)。所以编译开始了,过了一会儿我收到以下错误消息:Infileincludedfrom../.././gcc/c-lang.c:24:0:../.././gcc/system.h:499:20:erreur:conflictingtypesfor‘strsignal’/us

c++ - 如何使用 type_info 进行类型转换?

我存储了一个指向type_info对象的指针。intMyVariable=123;conststd::type_info*Datatype=&typeid(MyVariable);我如何使用它来将另一个变量类型转换为该类型?我试过这个,但它不起作用:std::cout使用类型转换的函数形式也不起作用:std::cout 最佳答案 很简单,您不能使用type_info来做到这一点。此外,在您的示例中,DataType不是类型,它是指向type_info类型对象的指针。你不能用它来转换。转换需要类型,而不是指针或对象!在C++0x中,您

解決element ui table的show-overflow-tooltip属性,设置其宽度

又是一个好几天的bug,可能是由于elementui版本网上很多方案不通,解决show-overflow-tooltip显示过长的问题el-table-columnwidth="240"prop="workSummary"header-align="center"align="center"label="工作总结"> template#default="scope">el-tooltipeffect="dark"placement="top">template#content>divclass="set-popper">{{scope.row.workSummary}}/div>/templa

C++ 错误 : object of abstract class type is not allowed: pure virtual function has no overrider

继承有问题。我不知道我做错了什么。FigureGeometry.h#ifndefFIGUREGEOMETRY#defineFIGUREGEOMETRYstaticconstfloatPI=3.14159f;classFigureGeometry{public:virtualfloatgetArea()const=0;virtualfloatgetPerimeter()const=0;};#endifCircle.h#ifndefCIRCLE#defineCIRCLE#include"FigureGeometry.h"classCircle:publicFigureGeometry{fl

c++ - "boost::mpl::identity<T>::type"在这里有什么意义?

我正在检查clamp的执行情况在boost中:templateTconst&clamp(Tconst&val,typenameboost::mpl::identity::typeconst&lo,typenameboost::mpl::identity::typeconst&hi,Predp){//assert(!p(hi,lo));//Can'tassertp(lo,hi)b/ctheymightbeequalreturnp(val,lo)?lo:p(hi,val)?hi:val;}如果我查找文档,identity返回模板参数不变。Theidentitymetafunction.Re