described_class_category

Conversion category for described classes.

Synopsis

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

struct described_class_category;

Description

Described classes are represented in JSON as objects with an element for each described data member. Described bases are flattened, that is members of bases are represented as direct elements of the object rather than elements of some subobjects.

By default a described class should not have non-public described members (including inherited members) or non-public non-empty described bases. Or more formally a type T is considered a described class if, given L, a class template of the form template<class...> struct L {},

  • boost::describe::has_describe_members<T>::value is true; and

  • boost::describe::describe_members<T, boost::describe::mod_private | boost::describe::mod_protected | boost::describe::mod_inherited> denotes L<>; and

  • std::is_union<T>::value is false.

Shadowed members are ignored both for requirements checking and for performing conversions.

Users can specialize conversion_category_for for their own types if they want them to be treated as described classes. For example:

namespace boost {
namespace json {

template <>
struct conversion_category_for<your::described_class>
{
    using type = described_class_category;
};

} // namespace boost
} // namespace json

See Also

Convenience header <boost/json.hpp>.