diff --git a/include/jsoncons_ext/jsonpath/json_location.hpp b/include/jsoncons_ext/jsonpath/json_location.hpp index 4d40bbca77..f008b29ff1 100644 --- a/include/jsoncons_ext/jsonpath/json_location.hpp +++ b/include/jsoncons_ext/jsonpath/json_location.hpp @@ -254,12 +254,13 @@ namespace jsonpath { private: allocator_type alloc_; std::vector elements_; + const path_node_type* base_node_; public: using iterator = typename std::vector::iterator; using const_iterator = typename std::vector::const_iterator; basic_json_location(const path_node_type& node, const allocator_type& alloc = allocator_type()) - : alloc_(alloc), elements_(node.size(), path_element_type{}) + : alloc_(alloc), elements_(node.size(), path_element_type{}), base_node_(std::addressof(node)) { std::size_t len = node.size(); @@ -297,6 +298,11 @@ namespace jsonpath { return elements_.back(); } + const basic_path_node& base_node() const + { + return base_node_; + } + string_type to_string() const { string_type buffer(alloc_);