草庐IT

ZN5boost

全部标签

c++ - 如何使用 Boost.serialize 序列化派生模板类?

我想序列化/反序列化以下类:classFeature{...virtualstringstr()=0;};templateclassGenericFeature:publicFeature{Tvalue;...virtualstringstr();};我阅读了boost.serialize文档,并说您必须注册类(class)。我可以在构造函数中注册它们。但是加载会有问题,因为注册是动态的,而不是静态的(据我了解,您必须在序列化/反序列化之前注册类)。如何保存/加载这些类型的类? 最佳答案 首先告诉boostFeature是抽象的,并

c++ - boost 异常

所有boost异常都源自std::exception吗?如果不是,它们是否都派生自某个基本异常类? 最佳答案 根据thedocumentationboost::exception不继承std::exception。FAQ解释原因。但是thispage解释了如何正确使用Boost异常。 关于c++-boost异常,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/1055319/

c++ - boost 异常

所有boost异常都源自std::exception吗?如果不是,它们是否都派生自某个基本异常类? 最佳答案 根据thedocumentationboost::exception不继承std::exception。FAQ解释原因。但是thispage解释了如何正确使用Boost异常。 关于c++-boost异常,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/1055319/

c++ - boost::thread sleep() 有什么作用?

我目前正在为boost线程开发一个小型包装类,但我并不真正了解sleep功能是如何工作的,这是我目前所得到的:BaseThread::BaseThread(){thread=boost::thread();bIsActive=true;}BaseThread::~BaseThread(){join();}voidBaseThread::join(){thread.join();}voidBaseThread::sleep(uint32_msecs){if(bIsActive)boost::this_thread::sleep(boost::posix_time::millisecond

c++ - boost::thread sleep() 有什么作用?

我目前正在为boost线程开发一个小型包装类,但我并不真正了解sleep功能是如何工作的,这是我目前所得到的:BaseThread::BaseThread(){thread=boost::thread();bIsActive=true;}BaseThread::~BaseThread(){join();}voidBaseThread::join(){thread.join();}voidBaseThread::sleep(uint32_msecs){if(bIsActive)boost::this_thread::sleep(boost::posix_time::millisecond

c++ - boost::shared_ptr<T> 和 boost::shared_ptr<const T> 是否共享引用计数?

关于boost::shared_ptr的陷阱有几个有趣的问题。s。其中之一是避免指向boost::shared_ptr的有用提示。和boost::shared_ptr到Derived类型的同一对象因为它们使用不同的引用计数并可能过早地销毁对象。我的问题:同时拥有boost::shared_ptr是否安全?和boost::shared_ptr指向T类型的同一对象,或者这会导致同样的问题吗? 最佳答案 绝对安全。以下代码示例:#include#includeintmain(int,char**){boost::shared_ptra(n

c++ - boost::shared_ptr<T> 和 boost::shared_ptr<const T> 是否共享引用计数?

关于boost::shared_ptr的陷阱有几个有趣的问题。s。其中之一是避免指向boost::shared_ptr的有用提示。和boost::shared_ptr到Derived类型的同一对象因为它们使用不同的引用计数并可能过早地销毁对象。我的问题:同时拥有boost::shared_ptr是否安全?和boost::shared_ptr指向T类型的同一对象,或者这会导致同样的问题吗? 最佳答案 绝对安全。以下代码示例:#include#includeintmain(int,char**){boost::shared_ptra(n

c++ - 如何使用 boost lib 编译 c++ 代码?在 Ubuntu 上

#include#include#include#include#include我使用了上面显示的标题。在Boost官网上找不到帮助。 最佳答案 假设您的代码中没有错误,您需要链接正确的boost库:boost_thread、boost_system和boost_date_time是您引用的,所以#include#include#include#include#includeintmain(){}该程序使用以下命令编译:g++-otesttest.cc-lboost_system-lboost_date_time-lboost_th

c++ - 如何使用 boost lib 编译 c++ 代码?在 Ubuntu 上

#include#include#include#include#include我使用了上面显示的标题。在Boost官网上找不到帮助。 最佳答案 假设您的代码中没有错误,您需要链接正确的boost库:boost_thread、boost_system和boost_date_time是您引用的,所以#include#include#include#include#includeintmain(){}该程序使用以下命令编译:g++-otesttest.cc-lboost_system-lboost_date_time-lboost_th

c++ - 使用 Visual Studio 2013 (Express) 构建 boost

是否有人使用VisualStudio2013Express成功构建了Boost?正如Boost网站所述,我对这是否可行感到困惑:KnownBugswithVisualStudio2013/VisualC++12.VisualStudio2013wasreleasedquitelateinthereleaseprocess,sothereexistseveralunresolvedissues.Theseinclude:Serializationcan'tcompilebecauseofamissinginclude.Usinghas_member_function_callable_w