草庐IT

boost-pool

全部标签

c++ - Boost.Log - 如何配置文本接收器后端以附加到旋转文件

我有一个sinks::text_file_backend接收器。假设我已经有一些旋转的日志文件:myLog001.log、myLog002.log等我希望接收器继续写入最后一个旋转的文件-myLog002.log,附加到其内容并从那里继续旋转。我只设法找到keywords::open_mode=append,但这只会附加在现有的myLogX文件之上,使它们变得更大,当然也很难阅读。这可以在Boost.Log中完成吗? 最佳答案 该功能内置于文本接收器中,thedocumentation包括一个设置文件名模式和以特定大小和时间旋转的规

c++ - Boost.Log - 如何配置文本接收器后端以附加到旋转文件

我有一个sinks::text_file_backend接收器。假设我已经有一些旋转的日志文件:myLog001.log、myLog002.log等我希望接收器继续写入最后一个旋转的文件-myLog002.log,附加到其内容并从那里继续旋转。我只设法找到keywords::open_mode=append,但这只会附加在现有的myLogX文件之上,使它们变得更大,当然也很难阅读。这可以在Boost.Log中完成吗? 最佳答案 该功能内置于文本接收器中,thedocumentation包括一个设置文件名模式和以特定大小和时间旋转的规

c++ - 是否可以在另一个语法定义中重用 boost::spirit::qi 语法?

是否可以在另一个语法中重用boost::spirit:qi语法(例如规则)?例如,如果我定义一个语法来将文本行解析为包含街道地址的结构。templatestructaddress_grammar:qi::grammar{...qi::rulestreet_name;qi::rulestreet_number;qi::ruleaddress_;}我可能想在其他两种语法中重用该语法,例如,一种可能用于解析存储在文件中的地址vector。另一种重用可能是更复杂的结构,其中一个字段是这个街道地址结构。templatestructcompany_grammar:qi::grammar{...qi

c++ - 是否可以在另一个语法定义中重用 boost::spirit::qi 语法?

是否可以在另一个语法中重用boost::spirit:qi语法(例如规则)?例如,如果我定义一个语法来将文本行解析为包含街道地址的结构。templatestructaddress_grammar:qi::grammar{...qi::rulestreet_name;qi::rulestreet_number;qi::ruleaddress_;}我可能想在其他两种语法中重用该语法,例如,一种可能用于解析存储在文件中的地址vector。另一种重用可能是更复杂的结构,其中一个字段是这个街道地址结构。templatestructcompany_grammar:qi::grammar{...qi

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++ - 什么是 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);