Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the master branch, built from commit 7789ef3d8d.
PrevUpHomeNext

result_for

Helper trait that returns result.

Synopsis

Defined in header <boost/json/result_for.hpp>

template<
    class T1,
    class T2>
struct result_for
Description

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)
    { ... }
}
See Also

try_value_to, try_value_to_tag

Convenience header <boost/json.hpp>


PrevUpHomeNext