草庐IT

boost-any

全部标签

c++ - 动态 boost 线程运行存储在具有共享指针的 vector 中的对象的方法

我有一个摄像头类,它是网络摄像头的抽象。该类有一个方法rxImageThread(),它本质上是一个图像服务器。我想在n个线程中为n个摄像机运行n个服务器,其中n是动态设置的(来自配置文件)。相机对象存储在一个vector中:std::vector>cameras;我在循环中创建相机对象:cameras.push_back(boost::shared_ptr(newcamera(ip,controlPort,dataPort,imagePort,name)));我有一个vector来存储线程:std::vector>threads;在一个循环中,我想让每个摄像头的rxImageThre

c++ - boost::thread 应用程序,奇怪的数据竞争报告

我编写了一个boost::thread应用程序,其中我可能有一些基于valgrind/helgrind报告的竞争条件。我想确定这些比赛的原因。程序是:#includeboost::mutexmyMutex;boost::condition_variablemyConditionalVariable;boolfunctionWasRun=false;voidfunction(){{boost::lock_guardlock(myMutex);functionWasRun=true;}myConditionalVariable.notify_one();//doSomething1();}

c++ - 使用 boost spirit qi 解析器迭代填充 BGL 图

此问题是"Iterativeupdateofabstractsyntaxtreewithboostspirit"的后续问题.已知:解析器语法允许递归要求是:解析器的AST必须是BGL图。每个解析器步骤的输入可以是一对多的符号想法:此处显示了有关将spirit解析为BGL图的一些基本想法Usingboostgraphlibrary:howtocreateagraph...,但不完全满足要求,因为我希望能够迭代地解析一对多符号。猜测BGL图和spirit解析器必须相互了解一些信息才能在正确的位置填充数据。首先想到的是解析器必须能够处理图的顶点。解决方案,例如Usingsemanticact

c++ - get_unit_value 在 boost ODEINT 中的作用

在以下代码中来自Boostlibrary:templatestructget_unit_value_impl{staticTvalue(constT&t){returnt;}typedefTresult_type;};...templatetypenamedetail::get_unit_value_impl::result_typeget_unit_value(constT&t){returndetail::get_unit_value_impl::value(t);}我不清楚get_unit_value的作用。它有什么作用?我们传递一些东西给它,它返回相同的值。为什么有人要把它包装

c++ - boost::ublas 如何获得 int 矩阵的行列式?

我找到了计算boost::ublas矩阵行列式的函数:templateValTypedet_fast(constublas::matrix&matrix){//createaworkingcopyoftheinputublas::matrixmLu(matrix);ublas::permutation_matrixpivots(matrix.size1());autoisSingular=ublas::lu_factorize(mLu,pivots);if(isSingular)returnstatic_cast(0);ValTypedet=static_cast(1);for(std

c++ - Boost::geometry 查询返回索引

我想要一个类,它使用boost::geometry::index::rtree作为空间索引器。只有这个类应该知道boost,所以我使用这样的东西:structVeryImportantInfo{...floatx;floaty;}classCatalogue{...public:std::vector>FindIn(floatx1,floatx2,floaty1,floaty2);protected:usingpoint=bg::model::point;usingvalue=std::pair>;usingbox=bg::model::box;boost::geometry::ind

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++ - 使用boost spirit从括号中提取字符串

我有以下字符串:%%DocumentNeededResources:CMap(90pv-RKSJ-UCS2C)我想解析它并存储/提取括号中的90pv-RKSJ-UCS2C字符串。我的规则如下:std::stringstrLinesRecur="%%DocumentNeededResources:CMap(90pv-RKSJ-UCS2C)";std::stringstrStartTokenRecur;std::stringtoken_intRecur;boolbParsedLine1=qi::phrase_parse(strLinesRecur.begin(),strLinesRecur

c++ - boost::property_tree 无一异常(exception)

我需要解析一些INI文件。为此,我尝试使用boost::property_tree,但在我的系统中不允许出现异常。如何在使用boost::property_tree时禁用异常支持?如果没有办法做到这一点,非常感谢对其他图书馆的任何建议。在@sehe的回答后,我尝试了这段代码,但是没有成功:#include#include#include#includenamespaceboost{voidthrow_exception(std::exceptionconst&e){std::cerr编译行代码使用以下参数:-c-DBOOST_USER_CONFIG=""-DBOOST_NO_EXCEP

c++ - Boost fusion 使用 lambda fold 参数包

在下面的代码中(C++14,C++17中没有“fold”),我试图在编译时使用boostfusionfold、参数包自动计算类字段的固定偏移量和一个lambda。不幸的是,这会导致编译时错误......是否可以这样做?[编辑:其他事情也困扰着我:这不是我想要的。我希望ControlledLayout2的_size在编译时可用(这就是我将其设为静态的原因),而不仅仅是在调用构造函数时可用]templatestructField2{typedefT_type;staticconstuint32_t_size;staticuint32_t_offset;};templateconstuint