Skip to content

Commit 377beb1

Browse files
committed
use result::unsafe_value where appropriate
1 parent 68aea8d commit 377beb1

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

example/use_allocator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ tag_invoke( try_value_to_tag<T>, const value& jv, const use_allocator_t<Alloc>&
6060
auto elem_res = try_value_to<ValueType>( val, full_ctx );
6161
if( elem_res.has_error() )
6262
return {boost::system::in_place_error, elem_res.error()};
63-
*ins++ = std::move(*elem_res);
63+
*ins++ = std::move(elem_res.unsafe_value());
6464
}
6565
return result;
6666
}

include/boost/json/detail/value_to.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ value_to_impl(
238238
return {boost::system::in_place_error, elem_res.error()};
239239
*ins++ = value_type<T>{
240240
key_type<T>(kv.key()),
241-
std::move(*elem_res)};
241+
std::move(elem_res.unsafe_value())};
242242
}
243243
return res;
244244
}
@@ -276,7 +276,7 @@ value_to_impl(
276276
auto elem_res = try_value_to<value_type<T>>( val, ctx );
277277
if( elem_res.has_error() )
278278
return {boost::system::in_place_error, elem_res.error()};
279-
*ins++ = std::move(*elem_res);
279+
*ins++ = std::move(elem_res.unsafe_value());
280280
}
281281
return result;
282282
}
@@ -401,7 +401,7 @@ struct to_described_member
401401
# pragma GCC diagnostic pop
402402
#endif
403403
if( member_res )
404-
(*res).* D::pointer = std::move(*member_res);
404+
(*res).* D::pointer = std::move(member_res.unsafe_value());
405405
else
406406
res = {boost::system::in_place_error, member_res.error()};
407407
}
@@ -637,7 +637,7 @@ value_to_impl(
637637
auto res = tag_invoke(try_value_to_tag<T>(), jv);
638638
if( res.has_error() )
639639
throw_system_error( res.error() );
640-
return std::move(*res);
640+
return std::move(res.unsafe_value());
641641
}
642642

643643
template<
@@ -655,7 +655,7 @@ value_to_impl(
655655
auto res = tag_invoke( try_value_to_tag<T>(), jv, Sup::get(ctx) );
656656
if( res.has_error() )
657657
throw_system_error( res.error() );
658-
return std::move(*res);
658+
return std::move(res.unsafe_value());
659659
}
660660

661661
template<
@@ -676,7 +676,7 @@ value_to_impl(
676676
auto res = tag_invoke(try_value_to_tag<T>(), jv, Sup::get(ctx), ctx);
677677
if( res.has_error() )
678678
throw_system_error( res.error() );
679-
return std::move(*res);
679+
return std::move(res.unsafe_value());
680680
}
681681

682682
//----------------------------------------------------------

include/boost/json/impl/value.ipp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ value::try_at(string_view key) noexcept
531531
auto r = try_as_object();
532532
if( !r )
533533
return r.error();
534-
return r->try_at(key);
534+
return r.unsafe_value().try_at(key);
535535
}
536536

537537
boost::system::result<value const&>
@@ -540,7 +540,7 @@ value::try_at(string_view key) const noexcept
540540
auto r = try_as_object();
541541
if( !r )
542542
return r.error();
543-
return r->try_at(key);
543+
return r.unsafe_value().try_at(key);
544544
}
545545

546546
boost::system::result<value&>
@@ -549,7 +549,7 @@ value::try_at(std::size_t pos) noexcept
549549
auto r = try_as_array();
550550
if( !r )
551551
return r.error();
552-
return r->try_at(pos);
552+
return r.unsafe_value().try_at(pos);
553553
}
554554

555555
boost::system::result<value const&>
@@ -558,7 +558,7 @@ value::try_at(std::size_t pos) const noexcept
558558
auto r = try_as_array();
559559
if( !r )
560560
return r.error();
561-
return r->try_at(pos);
561+
return r.unsafe_value().try_at(pos);
562562
}
563563

564564
object const&

0 commit comments

Comments
 (0)