【问题标题】:Any standard library implementation for boost::property treeboost::property 树的任何标准库实现
【发布时间】: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


【解决方案1】:

我认为没有任何类似的选择。

您可以编写自己的实现。

【讨论】:

    猜你喜欢
    • 2017-07-24
    • 2014-10-06
    • 2018-04-28
    • 1970-01-01
    • 2019-12-17
    • 1970-01-01
    • 1970-01-01
    • 2015-05-18
    • 1970-01-01
    相关资源
    最近更新 更多