草庐IT

TEMPLATE_DEBUG

全部标签

c++ - 在 C++ 中使用 DEBUG 宏的原因是什么?

我正在研究其他人构建的C++程序,并且看到了很多这样的DEBUG用法#ifdefDEBUGcout我本人仍在学习成为一名富裕的C++程序员的过程中,我主要使用VisualStudio和断点进行调试。所以我想知道,如果我能够单步执行代码来调试值,还有其他理由使用这些宏吗?尝试用谷歌搜索但没有找到太多有用的页面。谢谢。 最佳答案 有时您不想单步执行整个代码,而只是检查终端中的输出。如果代码是在定义了DEBUG的情况下编译的,可能在调试构建中,您会看到输出。对于发布版本,您不需要。如果您转到项目设置->配置属性->C/C++->预处理器-

c++ - 警告 : specialization of template in different namespace

通过以下代码我得到了警告:warning:specializationof‘templatestructstd::iterator_traits’indifferentnamespace[-fpermissive]templateclassstd::iterator_traits{public:typedefWorddifference_type;typedefWordvalue_type;typedefToken_ptrpointer;typedefWord&reference;typedefstd::bidirectional_iterator_tagiterator_catego

vivado 错误总结1——WARING:[Labtools 27-3361] the debug hub core was not detected make sure the clock

我在programdevice后无法打开debug的调试界面,出现了如下错误:WARING:[Labtools27-3361]thedebughubcorewasnotdetectedmakesuretheclockconnectedtothedebughubcoreisafreerunningclockandisactivemakesuretheBSCAN_SWITCE_USER_MASKdevicepropertyinvivadohardwaremanagerreflectstheuserscanchainsettinginthedesignandrefreshthedevice.解决办法

c++ - 我们什么时候需要 .template 结构

我做了如下程序#include#includetemplatestructClass{templatevoiddisplay(){std::coutvoidfunc(Classk){k.display();}intmain(){Classd;func(d);}上面的程序没有编译因为display()是一个模板成员函数,所以.template的资格之前display()必须完成。我说得对吗?但是当我制作下面的程序时#include#includetemplateclassmyClass{Tdummy;/*******/public:templatevoidfunc(myClassobj)

c++ - 将 Curiously Recurring Template Pattern (CRTP) 与其他类型参数一起使用

我尝试使用CuriouslyRecurringTemplatePattern(CRTP)并提供额外的类型参数:templateclassBase{Int*i;Float*f;};...classA:publicBase{};这可能是一个错误,更合适的父类(superclass)是Base--尽管这种参数顺序不匹配不是那么明显。如果我可以在typedef中使用名称参数的含义,这个错误会更容易看到:templateclassBase{typenameSubclass::Int_t*i;//error:invaliduseofincompletetype‘classA’typenameSub

c++ - '_ITERATOR_DEBUG_LEVEL' : value '0' doesn't match value '2' 检测到不匹配

使用VS2010构建时,我正在构建一个导致许多此类链接错误的库:errorLNK2038:mismatchdetectedfor'_ITERATOR_DEBUG_LEVEL':value'0'doesn'tmatchvalue'2'导致我必须同时发布我的库的发行版和调试版。我没有理由发布lib的调试版本,它只会使二进制分发版膨胀。但是在调试中构建的客户端代码拒绝链接到我的发布库。我以前见过这个问题,但他们似乎没有问正确的问题。我明白这个错误是什么,以及为什么我会得到它(好吧,有点;我不确定到底是什么发出了依赖性。你呢?),但我想知道的是如何消除这种依赖性的发生在我的库中?类似于在使用冲

c++ - "template"不需要关键字? [gcc/clang/Comeau 错误?]

这是测试代码templatevoidf(){Tt;t.f(0);//compilesevenwithoutthe"template"keyword,whatamImissing?}classabc{public:templatevoidf(int){}};intmain(){f();}我正在使用g++4.4.6。谢谢P.S:我已经大大编辑了我的问题。请不要介意。编辑:我向EDG的人问了这个问题,这是MikeHerrick不得不说的Wedodiagnosethisasanerrorin--strictmodeaswellasanymodethatenablesdependentnamel

c++ - G++ 编译器错误或错误代码? : "template definition of non-template"

作为大型程序的特征类的一部分,我尝试创建一个静态类变量,该变量可能具有不同的值,具体取决于实例化封闭类模板的类型。我已经简化了相关代码以生成我正在谈论的内容的简单示例:#include#include#includetemplatestructFoo;templatestructFoo::value>::type>{staticstd::stringmessage;};templatestructFoo::value>::type>{staticstd::stringmessage;};templatestd::stringFoo::message;对于GCC4.6,这会产生一个编译器

c++ - C++1 7's deduced ` auto` 非类型 `template` 参数是否可以使用显式非类型参数模式匹配模板?

考虑这个例子(alsoavailableonwandbox):templateclass>voidtest(){}templatestructX{};正在尝试实例化test()在clang++4.0(trunk)导致编译错误:error:nomatchingfunctionforcallto'test'test();^~~~~~~note:candidatetemplateignored:invalidexplicitly-specifiedargumentfor1sttemplateparametervoidtest(){}我最初的假设/直觉是test可用于匹配任何template具

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