Subject: [Boost-bugs] [Boost C++ Libraries] #12372: property_tree::get_optional without the template parameter
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-08-03 01:25:11
#12372: property_tree::get_optional without the template parameter
------------------------------+---------------------------
Reporter: harris.pc@⦠| Owner: cornedbee
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: property_tree
Version: Boost 1.61.0 | Severity: Optimization
Keywords: |
------------------------------+---------------------------
Is it possible to call
tree.get_optional<Data>(path)
without the <Data> ?
Note that Data is the type of the tree's Data.
Would also be nice to be able to get the data as a pointer so that data
can be updated in-place instead of get/push.
Like this, implemented as a free function (for the non-const variant):
Data * get_dataptr_optional( Tree & tree, string const& path )
{
if (optional<Tree &> node = tree.get_child_optional(path))
return &node->data();
return NULL;
}
cheers,
Paul
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12372> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC