From 872938af853c1b71882830261a45820d1c33c695 Mon Sep 17 00:00:00 2001 From: Mohammad Nejati Date: Tue, 5 Dec 2023 11:55:02 +0000 Subject: [PATCH] Make operator / a friend of string_path --- include/boost/property_tree/string_path.hpp | 56 +++------------------ 1 file changed, 7 insertions(+), 49 deletions(-) diff --git a/include/boost/property_tree/string_path.hpp b/include/boost/property_tree/string_path.hpp index e40714437..de2abc0a4 100644 --- a/include/boost/property_tree/string_path.hpp +++ b/include/boost/property_tree/string_path.hpp @@ -129,6 +129,13 @@ namespace boost { namespace property_tree return detail::dump_sequence(m_value); } + /// Concatenates two path components + friend string_path operator /(string_path p1, const string_path &p2) + { + p1 /= p2; + return p1; + } + /// Append a second path to this one. /// @pre o's separator is the same as this one's, or o has no separators string_path& operator /=(const string_path &o) { @@ -243,55 +250,6 @@ namespace boost { namespace property_tree typedef std::basic_string _string; typedef string_path< _string, id_translator<_string> > type; }; - - template inline - string_path operator /( - string_path p1, - const string_path &p2) - { - p1 /= p2; - return p1; - } - - // These shouldn't be necessary, but GCC won't find the one above. - template inline - string_path operator /( - string_path p1, - const typename String::value_type *p2) - { - p1 /= p2; - return p1; - } - - template inline - string_path operator /( - const typename String::value_type *p1, - const string_path &p2) - { - string_path t(p1); - t /= p2; - return t; - } - - template inline - string_path operator /( - string_path p1, - const String &p2) - { - p1 /= p2; - return p1; - } - - template inline - string_path operator /( - const String &p1, - const string_path &p2) - { - string_path t(p1); - t /= p2; - return t; - } - }} #endif