diff --git a/src/json.hpp b/src/json.hpp index 2dfa7c02..fc7781ea 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -257,6 +257,30 @@ struct is_compatible_integer_type_impl +struct is_compatible_enum_type_impl : std::false_type{}; + +template +struct is_compatible_enum_type_impl +{ + using RealLimits = std::numeric_limits; + using CompatibleLimits = std::numeric_limits::type>; + + static constexpr auto value = + CompatibleLimits::is_integer and + RealLimits::is_signed == CompatibleLimits::is_signed; +}; + +template +struct is_compatible_enum_type +{ + static constexpr auto value = is_compatible_enum_type_impl< +// quickfix for all enums + std::is_enum::value, RealIntegerType, + CompatibleEnumType>::value; +}; + template struct is_compatible_integer_type { @@ -281,6 +305,7 @@ struct is_compatible_basic_json_type std::is_constructible::value or std::is_same::value or is_compatible_array_type::value or + is_compatible_enum_type::value or is_compatible_object_type::value or is_compatible_float_type::value or is_compatible_integer_type::value; }; +template +struct is_basic_json_nested_class +{ + static auto constexpr value = std::is_same::value or + std::is_same::value or + std::is_same::value or + std::is_same::value or + std::is_same::value or + std::is_same::value; +}; // This trait checks if JSONSerializer::from_json(json const&, udt&) exists template