From 5839795725ef0adb278bad0f2449ecb88d0381d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20DELRIEU?= Date: Sun, 8 Jan 2017 22:49:02 +0100 Subject: [PATCH] remove useless helpers --- src/json.hpp | 28 +++------------------------- src/json.hpp.re2c | 28 +++------------------------- 2 files changed, 6 insertions(+), 50 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 4435102eb..8b94a3f38 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -152,23 +152,9 @@ template using enable_if_t = typename std::enable_if::type; template -using remove_cv_t = typename std::remove_cv::type; - -template -using remove_reference_t = typename std::remove_reference::type; - -template -using uncvref_t = remove_cv_t>; - -template -using conditional_t = typename std::conditional::type; +using uncvref_t = typename std::remove_cv::type>::type; // Taken from http://stackoverflow.com/questions/26936640/how-to-implement-is-enum-class-type-trait -template -using is_scoped_enum = - std::integral_constant::value and - std::is_enum::value>; - template using is_unscoped_enum = std::integral_constant::value and @@ -341,7 +327,7 @@ template struct conjunction : std::true_type {}; template struct conjunction : B1 {}; template struct conjunction -: conditional_t, B1> {}; +: std::conditional, B1>::type {}; template struct negation : std::integral_constant < bool, !B::value > {}; @@ -389,8 +375,6 @@ struct is_compatible_object_type_impl template struct is_compatible_object_type { - // As noted ahead, we need to stop evaluating traits if - // `CompatibleObjectType = void`, hence the conjunction static auto constexpr value = is_compatible_object_type_impl< conjunction>, has_mapped_type, @@ -499,11 +483,6 @@ struct has_to_json detect(std::declval>()))>::value; }; -// those declarations are needed to workaround a MSVC bug related to ADL -// (taken from MSVC-Ranges implementation) -void to_json(); -void from_json(); - // overloads for basic_json template parameters template ::value, int> = 0> -void to_json(Json &j, UnscopedEnumType e) +void to_json(Json &j, UnscopedEnumType e) noexcept { external_constructor::construct(j, e); } @@ -736,7 +715,6 @@ void from_json(Json const &j, ArithmeticType &val) struct to_json_fn { - // is it really useful to mark those as constexpr? template constexpr auto operator()(Json&& j, T&& val) const noexcept(noexcept(to_json(std::forward(j), std::forward(val)))) diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 412a9b49c..79d30e9d1 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -152,23 +152,9 @@ template using enable_if_t = typename std::enable_if::type; template -using remove_cv_t = typename std::remove_cv::type; - -template -using remove_reference_t = typename std::remove_reference::type; - -template -using uncvref_t = remove_cv_t>; - -template -using conditional_t = typename std::conditional::type; +using uncvref_t = typename std::remove_cv::type>::type; // Taken from http://stackoverflow.com/questions/26936640/how-to-implement-is-enum-class-type-trait -template -using is_scoped_enum = - std::integral_constant::value and - std::is_enum::value>; - template using is_unscoped_enum = std::integral_constant::value and @@ -341,7 +327,7 @@ template struct conjunction : std::true_type {}; template struct conjunction : B1 {}; template struct conjunction -: conditional_t, B1> {}; +: std::conditional, B1>::type {}; template struct negation : std::integral_constant < bool, !B::value > {}; @@ -389,8 +375,6 @@ struct is_compatible_object_type_impl template struct is_compatible_object_type { - // As noted ahead, we need to stop evaluating traits if - // `CompatibleObjectType = void`, hence the conjunction static auto constexpr value = is_compatible_object_type_impl< conjunction>, has_mapped_type, @@ -499,11 +483,6 @@ struct has_to_json detect(std::declval>()))>::value; }; -// those declarations are needed to workaround a MSVC bug related to ADL -// (taken from MSVC-Ranges implementation) -void to_json(); -void from_json(); - // overloads for basic_json template parameters template ::value, int> = 0> -void to_json(Json &j, UnscopedEnumType e) +void to_json(Json &j, UnscopedEnumType e) noexcept { external_constructor::construct(j, e); } @@ -736,7 +715,6 @@ void from_json(Json const &j, ArithmeticType &val) struct to_json_fn { - // is it really useful to mark those as constexpr? template constexpr auto operator()(Json&& j, T&& val) const noexcept(noexcept(to_json(std::forward(j), std::forward(val))))