variant_category

Conversion category for variants.

Synopsis

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

using variant_category = std::integral_constant< conversion_category, conversion_category::variant >;

Description

Variants are serialized the same way their active alternative is serialized. The opposite conversion selects the first alternative for which conversion succeeds.

By default a type T is considered a variant if given t, a glvalue of type const T, t.valueless_by_exception() is well-formed.

Users can specialize conversion_category_of for their own types if they want them to be treated as variants. For example:

namespace boost { namespace json {

template <>
struct conversion_category_of<your::variant> : variant_category
{ };

} }

Mathcing Types

Convenience header <boost/json.hpp>.