diff --git a/include/boost/json/impl/object.hpp b/include/boost/json/impl/object.hpp index 7417e7da..73004fb9 100644 --- a/include/boost/json/impl/object.hpp +++ b/include/boost/json/impl/object.hpp @@ -299,6 +299,36 @@ capacity() const noexcept -> return t_->capacity; } +//---------------------------------------------------------- +// +// Lookup +// +//---------------------------------------------------------- + +auto +object:: +at(string_view key) -> + value& +{ + auto it = find(key); + if(it == end()) + detail::throw_out_of_range( + BOOST_CURRENT_LOCATION); + return it->value(); +} + +auto +object:: +at(string_view key) const -> + value const& +{ + auto it = find(key); + if(it == end()) + detail::throw_out_of_range( + BOOST_CURRENT_LOCATION); + return it->value(); +} + //---------------------------------------------------------- template diff --git a/include/boost/json/impl/object.ipp b/include/boost/json/impl/object.ipp index 9fb82c1d..f075d004 100644 --- a/include/boost/json/impl/object.ipp +++ b/include/boost/json/impl/object.ipp @@ -460,30 +460,6 @@ swap(object& other) // //---------------------------------------------------------- -auto -object:: -at(string_view key) -> - value& -{ - auto it = find(key); - if(it == end()) - detail::throw_out_of_range( - BOOST_CURRENT_LOCATION); - return it->value(); -} - -auto -object:: -at(string_view key) const -> - value const& -{ - auto it = find(key); - if(it == end()) - detail::throw_out_of_range( - BOOST_CURRENT_LOCATION); - return it->value(); -} - auto object:: operator[](string_view key) -> diff --git a/include/boost/json/object.hpp b/include/boost/json/object.hpp index a80378d9..69c614ad 100644 --- a/include/boost/json/object.hpp +++ b/include/boost/json/object.hpp @@ -1257,7 +1257,7 @@ public: @throw std::out_of_range if no such element exists. */ - BOOST_JSON_DECL + inline value& at(string_view key); @@ -1278,7 +1278,7 @@ public: @throw std::out_of_range if no such element exists. */ - BOOST_JSON_DECL + inline value const& at(string_view key) const;