【发布时间】:2020-01-24 10:18:29
【问题描述】:
“boost/property_tree”是否有替代方案?
实际上,我正在尝试删除 C++ 的所有 boost 实现并使用标准库函数。 我已经能够找到其他一些 boost C++ 实现的替代方案,但对于属性树却没有。
不使用 boost 的动机:主要是处理添加的依赖项
bool Processor::init(std::istream& xml, std::istream& rioxml, const std::string& logconfig, const std::string& recoveryConfig) {
boost::property_tree::ptree config;
boost::property_tree::ptree rioconfig;
try {
boost::property_tree::xml_parser::read_xml(xml, config,
boost::property_tree::xml_parser::no_comments);
boost::property_tree::xml_parser::read_xml(rioxml, rioconfig,
boost::property_tree::xml_parser::no_comments);
return Initialize(config, rioconfig, logconfig, recoveryConfig);
}
catch(const boost::property_tree::xml_parser::xml_parser_error& ex){
LOG_ERROR(LOGCAT_DEFAULT, MSGID_UNKNOWN, "Failed to parse business config: " << logconfig);
return false;
}
}
【问题讨论】:
-
你为什么不想要提升?
-
我认为动机主要围绕着这个:stackoverflow.com/a/33453112/7054831
-
boost 是对 std 的补充 - 不是替代品或其他实施方式 - 并回答您的问题:不 - 也可能不会在不久的将来
-
你总是可以写你自己的替代品。
-
你只是在 std 库中寻找东西还是其他第三方库没有提升好吗?
标签: c++ c++11 boost c++-standard-library boost-propertytree