草庐IT

non-matching

全部标签

c++ - 为什么 boost::interprocess::managed_shared_ptr to non-const 不能转换为 managed_shared_ptr to const

据我了解,以下内容对boost::shared_ptr有效:boost::shared_ptrptr;...boost::shared_ptrc_ptr=ptr;//Valid相同的行为不适用于boost::interprocess::managed_shared_ptr。为什么? 最佳答案 boost::interprocess::managed_shared_ptr实际上不是共享指针;它只是一个辅助类,您可以使用它来定义一个类的类型。来自interprocessdocs:typedefmanaged_shared_ptr::ty

c++ - 非递归(non-recursive) Automake

我正在尝试将项目转换为使用非递归automake。基于对SO的搜索,我可以看到该主题已在一定程度上得到涵盖。但是关于如何将递归automake项目转换为非递归项目,实际上并没有任何问题。我已经读过KarelZak'sblog当然还有autotools-mythbuster.experiencesregardingnon-recursiveautomake有问题但它没有说明如何转换项目。唯一能解释一点的问题似乎是关于subdir-objectsoption.但是我无法用这些资源转换我的项目。因此这个问题。让我们从一个简单的项目设置开始:project/\--configure.ac|--

c++ - 避免接受 lambda 的方法的 const/non-const 重复

classFrame表示像素类型为P的图像.由于底层数据缓冲区格式的多种灵active,遍历其像素的算法并非易事。template//Pispixeltype;RM=is_row_majorclassFrame{//...templatevoiditerate(Ff){//iterateinawaythatisperformantforthisbufferif(stride==(RM?size.w:size.h)){auton=size.area();for(index_tk=0;k(stride)*(RM?size.h:size.w);for(index_tk0=0;k0我希望能够同

c++ - 规则 "A user-defined but do-nothing destructor is also a non-trivial destructor"是否过于严格?

关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。ImprovethisquestionclassBase{public:~Base(){}private:intval;};Basebase;//aglobalvariable你看,析构函数什么都不做,和c++编译器提供的默认析构函数一样。但是根据帖子Whatisanon-trivialdestructorinC++?,析构函数仍然是一个非平凡的析构函数我知道,标准中的每条规则都必须严格。但是,根据我粘贴的上面的代码,用户定义

c++ - 为什么这个参数顺序在 regex_match 的原型(prototype)中?

这里是6prototypes的简化版std::tr1::regex_match的regex_match(iterator1,iterator2,match_results&,regex&,flags=some_default);regex_match(iterator1,iterator2,regex&,flags=some_default);regex_match(Elem*,match_results&,regex&,flags=some_default);regex_match(Elem*,regex&,flags=some_default);regex_match(string

c++ - 错误 : control Reaches end of non void function

我正在学习C++,我从教科书上抄了这段代码,在编译代码时,最后出现错误。错误说:ControlReachesendofnon-voidfunction它位于代码的末尾:#include"ComplexNumber.hpp"#includeComplexNumber::ComplexNumber(){mRealPart=0.0;mImaginaryPart=0.0;}ComplexNumber::ComplexNumber(doublex,doubley){mRealPart=x;mImaginaryPart=y;}doubleComplexNumber::CalculateModulu

c++ - 临时/"non-addressable"固定大小数组?

标题没有更好的名字,我不确定我是否能够足够清楚地解释自己。我正在寻找一种通过索引访问“数据类型”的方法,但不强制编译器将其保存在数组中。问题发生在编写基于SSE/AVX内在函数的低级代码时。为了便于编程,我想编写如下代码,在“寄存器”(数据类型__m512)上使用固定长度循环:inlinevoidload(__m512*vector,constfloat*in){for(inti=0;ivector1和vector2被定义为数组的事实对编译器来说似乎很麻烦(在我的例子中是icc):看起来被迫使其“可寻址”,将其保存在堆栈中,从而生成大量我不需要的load和store指令。据我所知,这是

c++ - 振奋 spirit : how to match any lexer token in qi?

我想将C++函数声明与默认参数值匹配,但忽略这些值。例如:intmyFunction(inta,intb=5+4);这是词法分析器的(一部分):structLexer:boost::spirit::lex::lexer{Lexer(){identifier="[A-Za-z_][A-Za-z0-9_]*";numLiteral="([0-9]+)|(0x[0-9a-fA-F]+)";this->self.add("int")('+')('=')('(')(')')(';')(',')(identifier)(numLiteral);}};我想编写一些解析器规则,例如:function=

c++ - 编译器错误 : "Non-aggregates cannot be initialized with initializer list."

尝试在C++中创建一个简单的vector时,出现以下错误:Non-aggregatescannotbeinitializedwithinitializerlist.我使用的代码是:#include#include#includeusingnamespacestd;intmain(intargc,char*argv[]){vectortheVector={1,2,3,4,5};cout我试着把:CONFIG+=c++11进入我的.pro文件,保存并重建它。但是,我仍然遇到同样的错误。我正在使用我认为是Qt5.5的东西,如果它对你有意义的话,这是当我按下About时发生的事情:Qt'sAb

c++ - 使用非捕获 lambda 作为可变参数模板函数的函数指针参数给出 "no matching function call"

我目前正在尝试为ecs编写“foreachwith”。templatevoidforeach(void(*func)(Entitye,T...args)){std::vectorintersection;//...Findallentitieswithallthetypesfor(size_ti=0;i(intersection[i])...);}它与函数参数配合得很好voidfoo(Entitye,inti){setComp(e,(int)e);}foreach(foo);//Worksasexpected但不能像lambda那样复制和粘贴相同的函数foreach(//eveniff