described_enum_category
Conversion category for described enums.
Synopsis
Defined in header <boost/json/conversion.hpp>.
struct described_enum_category;
Description
Described enums are serialised as strings when their value equals to a described enumerator, and as integers otherwise. The reverse operation does not convert numbers to enums values, though, and instead produces an error.
By default a type T
is considered a described enum if boost::describe::has_describe_enumerators<T>::value
is true
.
Users can specialize conversion_category_for
for their own enums if they want them to be treated as described enums. For example:
namespace boost {
namespace json {
template <>
struct conversion_category_for<your::described_enum>
{
using type = described_enum_category;
};
} // namespace boost
} // namespace json
See Also
Convenience header <boost/json.hpp>.