From 2d847a06e624d52bf2b859bc6b92eeb58eb8b764 Mon Sep 17 00:00:00 2001 From: Dmitry Arkhipov Date: Mon, 25 May 2026 16:11:22 +0300 Subject: [PATCH] source_location argument for set_at_pointer and to_number --- include/boost/json/impl/pointer.ipp | 7 +++++-- include/boost/json/value.hpp | 13 ++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/boost/json/impl/pointer.ipp b/include/boost/json/impl/pointer.ipp index d07c48082..234a5374a 100644 --- a/include/boost/json/impl/pointer.ipp +++ b/include/boost/json/impl/pointer.ipp @@ -515,9 +515,12 @@ value::try_set_at_pointer( value& value::set_at_pointer( - string_view sv, value_ref ref, set_pointer_options const& opts ) + string_view sv, + value_ref ref, + set_pointer_options const& opts, + source_location const& loc) { - return try_set_at_pointer(sv, ref, opts).value(); + return try_set_at_pointer(sv, ref, opts).value(loc); } } // namespace json diff --git a/include/boost/json/value.hpp b/include/boost/json/value.hpp index 3e93bcf28..de49c05a3 100644 --- a/include/boost/json/value.hpp +++ b/include/boost/json/value.hpp @@ -1721,6 +1721,9 @@ class value /** Overload + @param loc @ref boost::source_location to use in thrown exception; the + source location of the call site by default. + @throws boost::system::system_error Overload **(3)** reports errors by throwing an exception. */ @@ -1733,9 +1736,9 @@ class value ! std::is_same::value, T>::type #endif - to_number() const + to_number(source_location const& loc = BOOST_CURRENT_LOCATION) const { - return try_to_number().value(); + return try_to_number().value(loc); } /// @} @@ -2991,6 +2994,9 @@ class value @param opts The options for the algorithm. + @param loc @ref boost::source_location to use in thrown exception; the + source location of the call site by default. + @return Reference to the element identified by `ptr`. @throws boost::system::system_error Overload **(1)** reports errors by @@ -3006,7 +3012,8 @@ class value set_at_pointer( string_view sv, value_ref ref, - set_pointer_options const& opts = {} ); + set_pointer_options const& opts = {}, + source_location const& loc = BOOST_CURRENT_LOCATION); /** Overload