草庐IT

boost-pool

全部标签

c++ - 从 Boost 多索引迭代器获取数字索引

我正在存储以下内容structArticle{std::stringtitle;unsigneddb_id;//idfieldinMediaWikidatabasedump};在Boost.MultiIndex容器中,定义为typedefboost::multi_index_container,hashed_unique,member>,hashed_unique,member>>>ArticleSet;现在我有两个迭代器,一个来自index和一个来自index.在不向structArticle添加数据成员的情况下,将这些索引转换为容器的随机访问部分的最简单方法是什么??

c++ - 如何将 std::tuple 类型与 boost::mpl 算法一起使用?

boost::mpl算法似乎无法在开箱即用的std::tuple类型上工作,例如,以下不编译(boost-1.46.0,g++快照2011-02-19):#include#include#includenamespacempl=boost::mpl;typedefmpl::vectortypes;static_assert(mpl::contains::value,"vectorcontainsbool");typedefstd::tupletypes2;//thefollowingdoesnotcompile://error:noclasstemplatenamed‘apply’in

c++ - 添加 #include <boost/thread/mutex.hpp> 会破坏我的 ActiveX 控件吗?

在ActiveX控件中使用boost::mutexheader是否存在已知问题?(boost版v1.39)如果我在VisualStudio2008中创建一个名为“DefaultOCXControl”的MFCActiveX控件项目,那么我可以构建它,该控件将自身注册为构建的一部分,并且可以像您期望的那样插入到ActiveX测试容器中。一切顺利。如果我再添加这一行:#include在我的DefaultOCXControlCtrl.h文件顶部并重建:构建结束时的注册步骤失败并显示:DebugAssertionFailed!Program:C:\Windows\system32\regsvr3

c++ - 在 Boost::Program_Options 中,如何设置 wstring 的默认值?

我的下面的代码没有工作:wstringconfig_file;//Declareagroupofoptionsthatwillbe//allowedonlyoncommandlinepo::options_descriptiongeneric("Genericoptions");generic.add_options()("help,h","producehelpmessage")("config,c",po::wvalue(&config_file)->default_value(L"DXDrv.cfg"),"nameofafileofaconfiguration.");编译失败,错

c++ - Boost 1.53 本地日期时间编译器错误 -std=c++0x

使用g++版本4.7.2,如果我尝试编译以下内容#includeclassBar{public:Bar(){tz_db_.load_from_file("/home/date_time_zonespec.csv");}private:boost::local_time::tz_databasetz_db_;};intmain(){return0;}使用-std=c++0x我得到以下错误。Infileincludedfrom/usr/local/include/boost/date_time/local_time/local_time_types.hpp:18:0,from/usr/lo

c++ - BOOST ASIO POST HTTP REQUEST——标题和正文

几天来我一直在努力让它工作,但我一直从服务器收到400错误。基本上,我要做的是向服务器发送一个httpPOST请求,该请求需要一个具有几个属性的JSON请求正文。这些是我目前正在使用的库已更新---2013年7月23日上午10:00刚刚注意到我使用的是TCP而不是HTTP,不确定这会对HTTP调用产生多大影响,但我找不到任何使用带有BOOST的纯HTTP的客户端示例::ASIO#include#include#include#include#include#include#include#includeusingboost::property_tree::ptree;usingboos

c++ - 错误 WinSock.h 已包含 Boost Windows Qt

我在Qtcreator上使用boostlib开发应用程序,我的平台是Windows8MSVC201364。我在每个类上都有两个类,我正在使用boostheader,现在我需要使用这个类,当我从另一个源文件中包含这些类头时,我得到了错误errorWinSock.hhasalreadybeenincluded在我的拳头课上,我添加了类似boost的标题#defineWIN32_LEAN_AND_MEAN#include#include#include#include#include#include#include#include#include#include#include#includ

c++ - 如何使用/创建 boost::multi_index?

有人可以向我详细解释如何使用boost::multi_index创建多索引映射吗?网上看了很多例子,还有boost页面,但是看不懂。我想通过多个int/long作为键来映射类对象指针。有人可以帮助我理解这一点吗?我有一个类X和该类的多个属性,它们是longlong、long、int,整数。我想将属性longlong、long、int、int存储为要映射到的键->。我希望能够在给定任何属性的情况下查找指针。有些属性对于X的每个对象都是唯一的,有些则不是唯一的。 最佳答案 Boost.Multi-index提供极其可定制的界面,但代价是

c++ - 使用 C++ boost asio 的 UDP 通信

我需要通过UDP与专用网络中的不同设备通信。我是使用boost的新手,但根据我在网上搜索的内容以及Boost网站上的教程,我想出了以下代码。我目前正在尝试从我自己的设备发送和接收数据。只是为了单元测试和最终确定代码。问题:我收不到任何消息。我错过了什么?#include#include#include#include#include"boost/asio.hpp"#include#include#include#defineSRVR_UDP_PORT10251#defineCLNT_UDP_PORT10252boost::arrayrecv_buffer;voidSender(std:

c++ - 如何使用 boost::format 生成十六进制输出?

考虑以下几点:#include#include#include#include#include#include#includeusingnamespacestd;typedefunsignedcharbyte;typedefvectorbyte_array;constbyte_arraybytes=list_of(0x05)(0x04)(0xAA)(0x0F)(0x0D);intmain(){conststringformatter="%1%-%2%-%3%-%4%-%5%";conststringresult=(format(formatter)%bytes[0]%bytes[1]%