草庐IT

MATCH_PARENT

全部标签

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++ - 使用模板继承调用祖 parent 构造函数

我选择使用模板化继承以避免多重继承和虚拟继承。我的目标是让各种child(4或5代或我无法控制的继承)有一个共同的函数调用,无论他们派生什么。我的解决方案是这样插入一个模板继承:templateclasscommon_call:publicBASE{public:voidfoo(){/*implementationindependentofbase*/}};classchild1:publiccommon_call{};classchild2:publiccommon_call{};这里有调用base的构造函数的问题。类base1和base2(不是我写的)有不同的构造函数,我必须在初始

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++ - Q文件对话框 : GtkDialog mapped without a transient parent

我有一个用C++中的Qt编写的程序的源代码片段,在Linux下运行,它创建一个QFileDialog来打开现有文件。如果我执行此操作,一切似乎都正常,但是当创建对话框时,我收到一条警告说“Gtk-Message:GtkDialogmappedwithoutatransientparent”。在另一个thread我发现调用此函数“gtk_window_set_transient_for()”可修复此错误。但是这个函数是GTK库的一部分但是我使用的是Qt框架。那么有什么解决方案可以解决这个错误吗?这个对话框的父级是一个QMainWindow:QStringfilename=QFileDia

C++11 std::regex_match 返回额外字符

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:Isgcc4.7buggyaboutregularexpressions?我遵循了http://www.cplusplus.com/reference/std/regex/regex_match/上的示例并在Ubuntu12.0464位上使用g++版本4.6.3编译以下是我的输出:stringliteralmatchedstringobjectmatchedrangematchedstringliteralwith3matchesstringobjectwith3matchesrangewith3matche

c++ - OpenCV 错误 : Sizes of input arguments do not match (The operation is neither 'array op array' )

我正在做一个在树莓派上使用opencv的项目。我遇到了一个看起来很简单的障碍,但我无法解决问题。首先,这是我的代码的一部分:{gray=cvarrToMat(py);///cvShowImage("camcvWin",py);//displayonlygraychannelif(img_num%2==1){cv::imwrite("/home/pi/test/Gray_2Image1.jpg",gray);}elseif(img_num%2==0){cv::imwrite("/home/pi/test/Gray_2Image2.jpg",gray);cv::Matimg2=cv::im

c++ - regex_match (""8 秒,regex (".{40000}"));?

更新2:实际上是regex(".{40000}");。仅此一项就已经花费了那么多时间。为什么?regex_match("",regex(".{40000}"));在我的PC上花费将近8秒。为什么?难道我做错了什么?我在i7-6700上的Windows10上使用来自MinGW的gcc4.9.3。这是一个完整的测试程序:#include#include#includeusingnamespacestd;intmain(){clock_tt=clock();regex_match("",regex(".{40000}"));cout我如何编译和运行它:C:\Users\...\coding>

c++ - 谷歌模拟 : How to configure custom message to explain match failure

如果匹配失败,Googlemock会打印如下消息:test.cpp:112:EXPECT_CALL(mock_obj,foo(MyMatcher(bar)))...Expectedarg#0:isequalto[1,2;3,4]Actual:{1}Expected:tobecalledonceActual:nevercalled-unsatisfiedandactive使用自定义匹配器MyMatcher我可以定义一个描述字符串,用于在匹配失败时生成失败消息。但它只定义了消息的Expectedarg#0部分。有什么方法可以自定义Actual的打印方式吗?在我的例子中,我不能为bar的类重

C++ 模板 : cannot match the last template in variadic class template

我正在学习C++11可变参数模板并创建了一个模板结构来计算给定列表的最大数量并尝试了:#include#includetemplatestructmax:std::integral_constantb?max::value:max::value)>{};templatestructmax:std::integral_constantb?max::value:max::value)>{};templatestructmax:std::integral_constant{};intmain(){std::cout::value但是g++提示:test.cc:7:58:error:wrong

c++ - 错误 : no match for ‘operator<’ in ‘__x < __y’ when trying to insert in two map

在代码中有两个映射。一个存储对和另一个存储,其中值是具有5个变量的类,数据类型为字符串、整数、字符串、整数、整数。但是在插入第二个映射期间,我收到错误g++错误:尝试在map中插入时,'__x如何解决。classValues{private:std::stringC_addr;intC_port;std::stringS_addr;intS_port;intC_ID;public:Values(std::string,int,std::string,int,int);voidprintValues();};Values::Values(std::stringCaddr,intCport