2
0
mirror of https://github.com/boostorg/json.git synced 2026-02-20 02:42:21 +00:00

object::at is inline

This commit is contained in:
Vinnie Falco
2020-10-25 13:45:11 -07:00
parent d81bc2f944
commit c02fd6339a
3 changed files with 32 additions and 26 deletions

View File

@@ -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<class P, class>

View File

@@ -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) ->

View File

@@ -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;