草庐IT

ZN5boost

全部标签

c++ - 使用 boost 波

我正在尝试着手研究boostwave,但到目前为止,我的运气并不好。我尝试了网站上的示例代码。如下:#include#include#include#include#include/////////////////////////////////////////////////////////////////////////////////IncludeWaveitself#include/////////////////////////////////////////////////////////////////////////////////Includethelexerstuf

c++ - 在 boost::signals2 中混合 boost 智能指针和 C++11 智能指针

我有一个应用程序使用boost::signals2在组件之间进行通信。我正在尝试通过slot_type(...).track(weak_ptr)使用它的自动连接管理功能。问题:在我的整个程序中,使用了std::shared_ptr。.track需要一个boost::weak_ptr,而我提供一个std::weak_ptr。这是我遇到的确切错误:cannotconvertargument1from'std::weak_ptr'to'constboost::weak_ptr&'有解决办法吗?还是我误解了问题? 最佳答案 我找到了解决办法

c++ - 如何将 boost::iostreams::null_sink 用作 std::ostream

我想根据运行时给出的标志使我的输出详细/非详细。我的想法是,构建一个依赖于标志的std::ostream,例如:std::ostreamout;if(verbose){out=std::coutelse{//Redirectstdouttonullbyusingboost'snull_sink.boost::iostreams::stream_buffernull_out{boost::iostreams::null_sink()};//Somehowconstructastd::ostreamfromnullout}现在我坚持从这样一个boost流缓冲区构建一个std::ostrea

c++ - Travis CI 上 Boost 中对 `std::__cxx11::basic_string 的 undefined reference

我正在尝试获取一个使用GitHub上的Boost的C+++项目,以便在TravisCI上正确编译。首先我在ubuntu上尝试了包和PPA,但是它们太旧了(我至少需要Boost1.61)。只有当我在TravisCI上编译Boost(下载、编译)时我才能让它工作,但不幸的是,编译时间很长(11-18分钟)并且日志文件非常大。考虑如何解决这个问题,我考虑在我的机器上编译boost,压缩,上传到一些网络服务器,然后下载并复制到/usr/local/[include/lib]相应的文件。Here是我在我的机器上使用的编译器。我使用编译了boost./bootstrap.sh--prefix=/h

c++ - 使用Boost获取成员函数的arity和paramerter类型? ( boost::函数特性)

对于普通函数,它工作得很好。下面的代码工作得很好。它只打印应有的内容:int__cdecl(int,char)2int,char#include#include#include#includeusingstd::cout;usingstd::endl;intfoo(int,char){return0;}intmain(){typedefBOOST_TYPEOF(foo)foo_type;;typedefboost::function_traitsfunction_traits;cout那么,问题是,如果foo是类bar的成员函数,我们该如何做到这一点?structbar{intfoo(

c++ - 我可以将 boost::make_shared 与私有(private)构造函数一起使用吗?

考虑以下几点:classDirectoryIterator;namespacedetail{classFileDataProxy;classDirectoryIteratorImpl{friendclassDirectoryIterator;friendclassFileDataProxy;WIN32_FIND_DATAWcurrentData;HANDLEhFind;std::wstringroot;DirectoryIteratorImpl();explicitDirectoryIteratorImpl(conststd::wstring&pathSpec);voidincreme

c++ - boost::asio server - 监听服务器端口失败

我有一个基于boost::asio的服务器,它工作正常,除了我试图添加一个检查,以确保没有其他东西在同一端口上接受连接。如果我创建两个服务器,其中一个始终接受连接,但另一个不报告任何错误(两者中的哪一个接受所有连接似乎是随机的)。服务器类的相关部分(它是一个使用基类的模板,该基类具有用于创建连接类型的Accepted()和typedef):MessageServer(boost::asio::io_service&io,unsignedshortport_num):BaseServerType(io),acceptor_(io,boost::asio::ip::tcp::endpoin

c++ - 将 boost::shared_lock 升级为独占锁

谁能解释一下boost::upgrade_lock的正确用法。以下代码导致死锁//Globaltypedefboost::shared_mutexMutex;typedefboost::shared_lockReadLock;typedefboost::upgrade_lockUpgradeLock;typedefboost::upgrade_to_unique_lockWriteLock;MutexsharedMutex;//Multithreadedreaderandwriter{ReadLockread(sharedMutex);for(intii=0;ii如果我在升级前用rea

c++ - 用 boost python 包装 C++ 模板类

我正在尝试用boothpython包装一个C++模板类。当前包装器出现错误。该程序基本上用于创建自定义vector并在python中使用它。#includetemplateclassallocator{public:T*allocate(size_t);voiddeallocate(T*,size_t);voidconstruct(T*,T);voiddestroy(T*);};templateclassvec{typedefT*iterator;typedefconstT*const_iterator;typedefsize_tsize_type;typedefTvalue_type

c++ - 对 `boost::chrono::system_clock::now()' 的 undefined reference - Boost 和 cpp-netlib

我来这里是为了解决让我感到沮丧的情况。很多。首先,我在Windows上,我使用MinGW作为编译器(C++)。我在让程序使用cpp-netlib和SSL(尝试发布到https站点)时遇到了一些问题。我相信一切都井井有条,除了这个一直在逃避我的错误。C:\boost_1_50_0\boost_1_50_0\stage\lib\libboost_thread-mgw46-mt-1_50.a(thread.o):thread.cpp||对“boost::chrono::system_clock::now()”的undefinedreference我确信我已经链接到chrono,以及BOOST