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 develop branch, built from commit d3a81b0deb.
PrevUpHomeNext

is_described_class

Determine if T should be treated as a described class.

Synopsis

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

template<
    class T>
struct is_described_class;
Description

Described classes are serialised as objects with an element for each described data member. A described class should not have described bases or non-public members.

Or more formally, given L, a class template of the form template<class...> struct L {};, if

then the trait provides the member constant value that is equal to true. Otherwise, value is equal to false.

Users can specialize the trait for their own types if they don't want them to be treated as described classes. For example:

namespace boost {
namespace json {

template <>
struct is_described_class<your::described_class> : std::false_type
{ };

} // namespace boost
} // namespace json

Users can also specialize the trait for their own types with described bases or described non-public data members to enable this conversion implementation. In this case the class will be serialized in a flattened way, that is members of bases will be serialized as direct elements of the object, and no nested objects will be created for bases.

See Also

Boost.Describe.

Convenience header <boost/json.hpp>


PrevUpHomeNext