...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Determine if T
should be
treated as a described class.
Defined in header <boost/json/conversion.hpp>
template< class T> struct is_described_class;
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
boost::describe::has_members<T, boost::describe::mod_public>::value
is true
;
and
boost::describe::describe_members<T, boost::describe::mod_private |
boost::describe::mod_protected>
denotes L<>
;
and
boost::describe::describe_bases<T, boost::describe::mod_any_access>
denotes L<>
;
and
std::is_union<T>::value
is false
;
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.
Convenience header <boost/json.hpp>