Opened 6 years ago
#12372 new Feature Requests
property_tree::get_optional without the template parameter
Reported by: | Owned by: | Sebastian Redl | |
---|---|---|---|
Milestone: | To Be Determined | Component: | property_tree |
Version: | Boost 1.61.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
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
Note:
See TracTickets
for help on using tickets.