草庐IT

specializations

全部标签

c++ - gcc 与 clang : noexcept parsed in unused template specialization when static casting

我正在尝试将函数指针静态转换为特定函数重载,但似乎clang仍会解析(未使用的)模板特化的noexcept语句,从而生成编译器错误。如果未使用相应的函数重载,GCC似乎并不关心noexcept。templatevoidfun(T)noexcept(T(1)){}voidfun(int){}voidfun(int*){}intmain(){inta;fun(&a);//callingworksfinefun(a);static_cast(&fun);//staticcastingdoesn't}https://godbolt.org/z/ixpl3f这里是哪个编译器出错了?当将函数指针转

c++ - 错误 : 'Failed to specialize function template' C2893 'std::invoke'

我正在VisualStudio2013中编写MFC程序,但我不断收到以下两个错误错误C2893无法特化函数模板'unknown-typestd::invoke(_Callable&&,_Types&&...)'和错误C2672“std::invoke”:找不到匹配的重载函数错误与文件xthread第238行有关我是c++/MFC的新手,我正在尝试编写一个将在后台运行到系统时间的函数。这是我使用的代码:voidtask1(ExperimentTab&dlg){while(true){CStringshowtime=CTime::GetCurrentTime().Format("%H:%M

c++ - g++ 错误 : specialization after instantiation (template class as friend)

考虑以下C++代码:templateclassSingleton{};classConcreteSingleton:publicSingleton{templatefriendclassSingleton;};intmain(){}Singleton应该是ConcreteSingleton的friend:它适用于Microsoft的可视化C++编译器。但是,我不能用g++4.8.4编译它。错误是:error:specializationof‘Singleton’afterinstantiationtemplatefriendclassSingleton;有什么办法可以解决吗?

c++ - 模板调用 : Actual specialization not called

#includeusingnamespacestd;templatevoidtest(){coutvoidtest(){cout();//expectedoutput2butactualoutput1}为什么输出是1而不是2? 最佳答案 test(注意:末尾没有括号)会产生您期望的结果。写成test用“不带参数并返回std::string的函数”类型实例化模板 关于c++-模板调用:Actualspecializationnotcalled,我们在StackOverflow上找到一个类似

c++ - STL 中的 VS 编译器错误 C2752 ("more than one partial specialization matches")

不知何故,我喜欢这些显示(基本?)问题的“最短”程序。在VS2008中测试一些模板代码时出现了这个错误(它也已在VS2010和VS2012中得到确认,见下文):c:\programfiles(x86)\microsoftvisualstudio9.0\vc\include\xmemory(225):errorC2752:'std::_Ptr_cat_helper':morethanonepartialspecializationmatchesthetemplateargumentlistwith[_T1=constfloat(**),_T2=constfloat(**)]我可以将问题归

c++ - 函数模板 : Different specializations with type traits

考虑到类模板,可以使用类型特征和虚拟启动器模板参数为某些类型的组提供模板特化。我已经askedthatearlier.现在,对于函数模板,我需要同样的东西:即,我有一个模板函数,并且想要对一组类型进行特化,例如,作为类X的子类型的所有类型>。我可以用这样的类型特征来表达这一点:std::enable_if::value>::type我想过这样做:templatevoidfoo(){//Dosomething}templatevoidfoo::value>::type>(){//Dosomethingdifferent}但是,这不起作用,因为函数模板不允许偏特化。那怎么办呢?也许是类型特

c++ - 为什么此代码会出现错误 "template specialization requires ' template< >'"?

当我尝试用Clang编译它时templatestructField{charconst*name;Field(charconst*name):name(name){}};templateclassCRTP{staticFieldconst_field;};classClass:publicCRTP{};FieldconstCRTP::_field("blah");intmain(){}我明白了error:templatespecializationrequires'template'FieldconstCRTP::_field("blah");~~~~~~~~~~~^我根本不明白这个错

vue2/3 - 报错You may use special comments to disable some warnings.(// eslint-disable-next-line解决方法教程)

错误提示在vue2/3项目开发中,运行或打包时出现如下报错信息,提供详细解决方法。oumayusespecialcommentstodisablesomewarnings.Use//eslint-disable-next-linetoignorethenextline.Use/eslint-disabletoignoreallwarningsinafile.只要你和我一样报错,就可以解决掉这个问题!解决教程其实,

You may use special comments to disable some warnings.Use // eslint-disable-next-line to ignore th

目录报错信息:报错截图:报错分析:报错解决:报错信息: 1:1 error Thetemplaterequireschildelement       vue/valid-template-root 1:1 error Componentname"one"shouldalwaysbemulti-word vue/multi-word-component-names 6:8 error 'axios'isdefinedbutneverused        no-unused-vars✖19problems(19errors,0warnings)Youmayusespecialcommentst

Vue报错:may use special comments to disable some warnings. Use // eslint-disable-next-line to ignore

项目运行时,报错Youmayusespecialcommentstodisablesomewarnings.Use//eslint-disable-next-linetoignorethenextline.Use/*eslint-disable*/toignoreallwarningsinafile.解决办法方法一找到项目根目录下的bulid文件夹下的webpack.base.conf.js,找到以下代码块并注释掉第三行代码module:{rules:[...(config.dev.useEslint?[createLintingRule()]:[]),//注释掉该行代码{test:/\.vu