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
-
boost::describe::has_members<T, boost::describe::mod_public>::value
istrue
; and -
boost::describe::describe_members<T, boost::describe::mod_private | boost::describe::mod_protected>
denotesL<>
; and -
boost::describe::describe_bases<T, boost::describe::mod_any_access>
denotesL<>
; and -
std::is_union<T>::value
isfalse
;
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
Convenience header <boost/json.hpp>.