草庐IT

boost-library

全部标签

c++ - 与 boost::property_tree XML 解析器一起使用时 boost::coroutine 库崩溃

我正在使用Simple-Web-Server用于创建将XML转换为JSON的简单Web服务的库,反之亦然。反过来,它使用了几个boost库以及其中的boost::coroutine。对于XMLJSON转换,我使用boost::property_tree库进行中间表示。这是代码:#include#include#include#defineBOOST_SPIRIT_THREADSAFE#include#include#includeusingnamespacestd;usingnamespaceboost::property_tree;usingHttpServer=SimpleWeb:

c++ - 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error>>

我创建了客户端应用程序。当我发送单个消息clientsever时它工作正常。但是当我出于性能目的发送大量消息时,客户端会以两种不同的方式崩溃:(gdb)runStartingprogram:/home/x64joxer/workerGenerators/Worker2/worker-t-i192.168.0.6-p6000-d5-l//home/x64joxer/workerGenerators/Worker2/[Threaddebuggingusinglibthread_dbenabled]Usinghostlibthread_dblibrary"/lib/x86_64-linux-

c++ - 使用 Boost 库 Qt C++ 更新翻译文件

我在我的C++项目中使用Boost库。我将它包含在PRO文件中,如下所示:win32:INCLUDEPATH+=C:/boost_1_60_0win32:LIBS+="-LC:/boost_1_60_0/stage/lib/"但是,当我在终端(cmd)上运行以下命令来更新我的翻译文件时:lupdateMyProject.pro它在Boost库路径中搜索文件进行更新。这正常吗?我该怎么做才能不在Boost库路径中搜索?现在,当我需要运行lupdate命令时,我正在评论Boost包含行,但我不想每次需要更新我的翻译文件时都这样做。Qt5.3.2boost1.6.0

c++ - 为什么 Boost 原子使用中的多生产者队列是无等待的

BoostAtomic示例中的无等待多生产者队列:templateclasswaitfree_queue{public:structnode{Tdata;node*next;};voidpush(constT&data){node*n=newnode;n->data=data;node*stale_head=head_.load(boost::memory_order_relaxed);do{n->next=stale_head;}while(!head_.compare_exchange_weak(stale_head,n,boost::memory_order_release));

c++ - 如何使用 Boost.Spirit.Qi 增量解析(并作用于)大文件?

我为自定义文本文件格式创建了一个Qi解析器。有数以万计的条目要处理,每个条目通常有1-10个子条目。我放了一个精简的解析器工作示例here.#include#include#include#include#include#include#include#include#include#include#include#include#includeusingstd::string;usingstd::vector;usingstd::cout;usingstd::endl;namespacemodel{namespaceqi=boost::spirit::qi;structspectru

c++ - 为什么 Eigen Matrix Library 的具有整数数据的固定大小类型不是 PoD?

给定一个固定大小的Eigen类型,比如说Eigen::Vector3d,为什么这个类型不是PoD?底层数据是一个包含3个double的数组,不需要非平凡的构造函数或析构函数。 最佳答案 在模板方面,很多位(取决于版本)在构造函数中进行,尽管是在编译时。虽然所有这些都在编译时进行评估并因此进行了优化,但仍然存在一个空的构造函数。如果您向POD类型添加一个空的构造函数,那么在使用std::copy时它也不会被memcpy。试试这个:#include#include#include#includestructnotpod{notpod()

c++ - boost 收集范围的适配器

我想编写一个boost适配器放在适配器链的末尾以创建一个集合,如下所示:sets=input|filtered(...)|transformed(...)|to_set;使用Method3.1我写了下面的代码,它似乎按预期工作:namespacedetail{structto_set_forwarder{};};templateinlineautooperator|(R&r,detail::to_set_forwarder){returnset(r.begin(),r.end());}templateinlineautooperator|(constR&r,detail::to_set

c++ - 使用 boost spirit 的递归 BNF 规则

我正在尝试使用boostspirit为以下BNF规则编写解析器(Boostv1.64)规则是:::=integer::="in"|"out"|"in_out"::="["[]"]"::="("(",")+")"::=||下面是我的尝试,使用boost::make_recursive_variant它似乎在字符串in上工作正常但它在in[2]上失败了。我的错误在哪里?什么是优雅的解决方案?namespaceAst{enumclassTypeName{IN,OUT,INOUT};usingNumericLiteral=int;usingTypeSpec=boost::make_recurs

c++ - 使用整数索引访问 boost::graph 中的特定边

这与我昨天关于使用整数索引访问顶点的问题有关。该线程在这里:Accessingspecificverticesinboost::graph那里的解决方案表明,使用vecS作为顶点类型,确实可以使用整数索引访问特定顶点。我想知道boost是否提供了类似的方法来使用整数索引有效地访问任意边缘。附件是描述前者(有效访问具有整数索引的顶点)和基于开发人员显式维护两个数组访问边的代码,from[]和to[],分别存储边的源和目标。代码创建了下图:#include#include#include#include#includeusingnamespaceboost;typedefadjacency

c++ - CMake Find_Package(PythonLibs): Does CMake give a preference to dynamic or static libraries?

当我运行FindPackage(PythonLibs)时,它首先找到静态python库python3.5m.a,而不是python3.5m.so。这是CMake的预期行为吗?我怀疑它不符合CMakebugreport;然而,这个错误报告是在2005年提交的。13年来情况发生了变化。如果共享库有偏好,那么知道为什么CMake会找到静态库而不是共享库吗?我已经通过使用SET()命令告诉CMake正确的库在哪里用于我自己的构建来解决构建问题。我正在寻找一个可以更好地理解CMake在这种情况下的行为的答案,因为我正在尝试解决不同的problem,并在共享库中找到static对我来说似乎很奇怪。