From b2543e06d8ea1121f1423c435d5e30c81cafe472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DELRIEU?= <theo@tanker.io> Date: Sun, 8 Jan 2017 18:59:51 +0100 Subject: [PATCH] removed is_compatible_float_type trait --- src/json.hpp | 17 +++-------------- src/json.hpp.re2c | 17 +++-------------- 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 93e996f6..fd27d83f 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -461,14 +461,6 @@ struct is_compatible_integer_type RealIntegerType, CompatibleNumberIntegerType > ::value; }; -template <typename RealFloat, typename CompatibleFloat> -struct is_compatible_float_type -{ - static constexpr auto value = - std::is_constructible<RealFloat, CompatibleFloat>::value and - std::is_floating_point<CompatibleFloat>::value; -}; - template <typename BasicJson, typename T> struct is_basic_json_nested_type { @@ -568,12 +560,9 @@ void to_json(Json &j, const CompatibleString &s) external_constructor<value_t::string>::construct(j, s); } -template < - typename Json, typename CompatibleNumberFloatType, - enable_if_t<is_compatible_float_type<typename Json::number_float_t, - CompatibleNumberFloatType>::value, - int> = 0> -void to_json(Json &j, CompatibleNumberFloatType val) noexcept +template <typename Json, typename FloatType, + enable_if_t<std::is_floating_point<FloatType>::value, int> = 0> +void to_json(Json &j, FloatType val) noexcept { external_constructor<value_t::number_float>::construct(j, val); } diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index e6921132..702f3fd3 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -461,14 +461,6 @@ struct is_compatible_integer_type RealIntegerType, CompatibleNumberIntegerType > ::value; }; -template <typename RealFloat, typename CompatibleFloat> -struct is_compatible_float_type -{ - static constexpr auto value = - std::is_constructible<RealFloat, CompatibleFloat>::value and - std::is_floating_point<CompatibleFloat>::value; -}; - template <typename BasicJson, typename T> struct is_basic_json_nested_type { @@ -568,12 +560,9 @@ void to_json(Json &j, const CompatibleString &s) external_constructor<value_t::string>::construct(j, s); } -template < - typename Json, typename CompatibleNumberFloatType, - enable_if_t<is_compatible_float_type<typename Json::number_float_t, - CompatibleNumberFloatType>::value, - int> = 0> -void to_json(Json &j, CompatibleNumberFloatType val) noexcept +template <typename Json, typename FloatType, + enable_if_t<std::is_floating_point<FloatType>::value, int> = 0> +void to_json(Json &j, FloatType val) noexcept { external_constructor<value_t::number_float>::construct(j, val); }