草庐IT

ZN5boost

全部标签

c++ - 什么是 C++17 等价于 boost::filesystem::unique_path()?

C++17上的std::filesystem和许多C++17之前的编译器的std::experimental::filesystem均基于boost::filesystem并且几乎所有这些都可以移植到较新的std。但我没有看到与boost::filesystem::unique_path()等效的std::filesystem。在std中是否有我没有注意到的等价物?或者有没有推荐的方法来模仿实现?当我的代码注意到它在支持std::filesystem和的平台上编译时,我真的希望替换boost::filesystem依赖项unique_path()是我的转换中唯一不明显的部分。

c++ - 使用 boost::program_options 时,如何设置参数的名称?

使用boost::program_options时,如何设置boost::program_options::value()的参数名称?#include#includeintmain(){boost::program_options::options_descriptiondesc;desc.add_options()("width",boost::program_options::value(),"Givewidth");std::cout以上代码给出:--widthargGivewidth我想要的是替换arg使用更具描述性的名称,例如NUM:--widthNUMGivewidth

c++ - 使用 boost::program_options 时,如何设置参数的名称?

使用boost::program_options时,如何设置boost::program_options::value()的参数名称?#include#includeintmain(){boost::program_options::options_descriptiondesc;desc.add_options()("width",boost::program_options::value(),"Givewidth");std::cout以上代码给出:--widthargGivewidth我想要的是替换arg使用更具描述性的名称,例如NUM:--widthNUMGivewidth

c++ - 对 boost::gregorian::greg_month::as_short_string() const 的 undefined reference

这被问了好几次,但我不知道我做错了什么。我正在尝试将当前日期减去7。这是主要的:#include#include#include#includeusingnamespacestd;usingnamespaceboost::gregorian;intmain(intargc,char**argv){time_trawtime;structtm*timeinfo;time(&rawtime);timeinfo=localtime(&rawtime);datecdate(timeinfo->tm_year+1900,timeinfo->tm_mon+1,timeinfo->tm_mday);

c++ - 对 boost::gregorian::greg_month::as_short_string() const 的 undefined reference

这被问了好几次,但我不知道我做错了什么。我正在尝试将当前日期减去7。这是主要的:#include#include#include#includeusingnamespacestd;usingnamespaceboost::gregorian;intmain(intargc,char**argv){time_trawtime;structtm*timeinfo;time(&rawtime);timeinfo=localtime(&rawtime);datecdate(timeinfo->tm_year+1900,timeinfo->tm_mon+1,timeinfo->tm_mday);

c++ - boost::date_time 和 std::chrono 之间的互操作性

boost::date_time和std::chrono的互操作性如何?例如,有没有办法在boost::posix_time::ptime和std::chrono::time_point之间进行转换?我尝试搜索有关此类转换的文档,但找不到任何文档。 最佳答案 我在boost提交邮件列表中找到了这个:http://lists.boost.org/boost-commit/2009/04/15209.php以下是相关功能:templatestructconvert_to>{inlinestaticposix_time::ptimeapp

c++ - boost::date_time 和 std::chrono 之间的互操作性

boost::date_time和std::chrono的互操作性如何?例如,有没有办法在boost::posix_time::ptime和std::chrono::time_point之间进行转换?我尝试搜索有关此类转换的文档,但找不到任何文档。 最佳答案 我在boost提交邮件列表中找到了这个:http://lists.boost.org/boost-commit/2009/04/15209.php以下是相关功能:templatestructconvert_to>{inlinestaticposix_time::ptimeapp

c++ - 使用 Boost Asio 异步等待文件描述符

我正在尝试将D-Bus与我的boost::asio应用程序集成。D-Bus有一个API可以枚举一组Unix文件描述符(主要是套接字,但也可以是FIFO)以进行监视。当这些描述符有东西要读取时,我应该通知D-BusAPI,以便它可以读取它们并执行它。目前我正在这样做:usingboost::asio::posix::stream_descriptor;voidread_handle(stream_descriptor*desc,constboost::system::error_code&ec,std::size_tbytes_read){if(!ec){stream_descripto

c++ - 使用 Boost Asio 异步等待文件描述符

我正在尝试将D-Bus与我的boost::asio应用程序集成。D-Bus有一个API可以枚举一组Unix文件描述符(主要是套接字,但也可以是FIFO)以进行监视。当这些描述符有东西要读取时,我应该通知D-BusAPI,以便它可以读取它们并执行它。目前我正在这样做:usingboost::asio::posix::stream_descriptor;voidread_handle(stream_descriptor*desc,constboost::system::error_code&ec,std::size_tbytes_read){if(!ec){stream_descripto

c++ - 如何使用新的 Visual Studio 2013 预览版构建 boost ?

在尝试构建Boost1.54时对于VisualStudio2013Preview(MSVC12)它警告:Unknowncompilerversion-pleaseruntheconfiguretestsandreporttheresults然后失败并出现错误:boost_1_54_0\boost/iterator/detail/facade_iterator_category.hpp(166):errorC2039:'assert_not_arg':isnotamemberof'boost::mpl'看起来MSVC11中的旧库不兼容。我真的非常想测试新的IDE/Compiler版本并且