【问题标题】:boost::property_tree::ordered_end() missingboost::property_tree::ordered_end() 缺失
【发布时间】:2015-03-04 18:02:41
【问题描述】:

我正在尝试迭代提升属性树。 docs 声明

您可以使用ordered_begin() 获得所有孩子的有序视图 和ordered_end()。

但是,当我写的时候

for ( boost::property_tree::ptree::const_assoc_iterator it =
            myPropTree.ordered_begin();
    it != myPropTree.ordered_end();
    it++ )

编译器抱怨

error: 'boost::property_tree::ptree' has no member named 'ordered_end'
提升 v1.55 明威 代码::块

【问题讨论】:

  • header,没看到ordered_end(),但是有/** Returns the not-found iterator. Equivalent to end() in a real associative container. */ assoc_iterator not_found();

标签: c++ boost boost-propertytree


【解决方案1】:

The ptree documentation says:

assoc_iterator ordered_begin();

按键顺序将迭代器返回给第一个孩子。

const_assoc_iterator ordered_begin() const;

按键顺序将迭代器返回给第一个孩子。

assoc_iterator not_found();

返回未找到的迭代器。等效于真实关联容器中的 end()。

const_assoc_iterator not_found() const;

返回未找到的迭代器。等效于真实关联容器中的 end()。

所以基本上ordered_end函数被称为not_found

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-27
    • 2019-02-10
    • 2012-09-14
    • 2015-10-02
    • 2017-12-27
    • 2023-03-07
    相关资源
    最近更新 更多