...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Helper trait that returns result
.
Defined in header <boost/json/system_error.hpp>
template< class T1, class T2> struct result_for
The primary template is an incomplete type. The library provides a partial
specialisation result_for<T1, value>
, that has nested type alias type
that aliases the type result<T1>
.
The purpose of this trait is to let users provide non-throwing conversions
for their types without creating a physical dependency on Boost.Json. For
example:
namespace boost { namespace json { template < class T> struct value_to_tag; template < class T1, class T2> struct result_for; } } namespace mine { class my_class; ... template < class JsonValue> boost::json::result_for<my_class, JsonValue> tag_invoke(boost::json::try_value_to_tag<my_class>, const JsonValue& jv) { ... } }
try_value_to
,
try_value_to_tag
Convenience header <boost/json.hpp>