From 7a2099e7de146727c797e4984a3001f3fc6b0584 Mon Sep 17 00:00:00 2001 From: Remotion Date: Sun, 13 May 2018 00:04:30 +0200 Subject: [PATCH] Using FMT_CONSTEXPR_DECL for variables. Replaced std::enable_if_t by std::std::enable_if<>::type. Replaced variable templates by structs. --- include/fmt/ranges.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 37157188..02e69001 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -35,7 +35,7 @@ struct formatting_range : formatting_base { Char prefix = '{'; Char delimiter = ','; Char postfix = '}'; - static FMT_CONSTEXPR bool add_spaces = false; + static FMT_CONSTEXPR_DECL const bool add_spaces = false; }; template @@ -43,7 +43,7 @@ struct formatting_tuple : formatting_base { Char prefix = '['; Char delimiter = ','; Char postfix = ']'; - static FMT_CONSTEXPR bool add_spaces = false; + static FMT_CONSTEXPR_DECL const bool add_spaces = false; }; namespace internal { @@ -81,11 +81,9 @@ class is_like_std_string { static void check(...); public: - static FMT_CONSTEXPR bool value = !std::is_void(nullptr))>::value; + static FMT_CONSTEXPR_DECL const bool value = !std::is_void(nullptr))>::value; }; -template -FMT_CONSTEXPR bool is_like_std_string_v = is_like_std_string::value; template struct conditional_helper {}; @@ -100,7 +98,10 @@ struct is_range_> : std::true_type {}; template -FMT_CONSTEXPR bool is_range_v = is_range_::value && !is_like_std_string::value; +struct is_range { + static FMT_CONSTEXPR_DECL const bool value = is_range_::value && !is_like_std_string::value; +}; + /// tuple_size and tuple_element check. template @@ -113,11 +114,13 @@ class is_tuple_like_ { static void check(...); public: - static FMT_CONSTEXPR bool value = !std::is_void(nullptr))>::value; + static FMT_CONSTEXPR_DECL const bool value = !std::is_void(nullptr))>::value; }; template -FMT_CONSTEXPR bool is_tuple_like_v = is_tuple_like_::value && !is_range_::value; +struct is_tuple_like { + static FMT_CONSTEXPR_DECL const bool value = is_tuple_like_::value && !is_range_::value; +}; //=-------------------------------------------------------------------------------------------------------------------- template @@ -143,7 +146,8 @@ void for_each(Tuple &&tup, F &&f) { // ===================================================================================================================== template -struct formatter>> { +struct formatter::value>::type> { fmt::formatting_tuple formatting; @@ -177,10 +181,11 @@ struct formatter -struct formatter>> { +struct formatter< RangeT, Char, + typename std::enable_if::value>::type> { - static FMT_CONSTEXPR std::size_t range_length_limit = - FMT_RANGE_OUTPUT_LENGTH_LIMIT; // output only up to N items from the range. + static FMT_CONSTEXPR_DECL const std::size_t range_length_limit = + FMT_RANGE_OUTPUT_LENGTH_LIMIT; // output only up to N items from the range. fmt::formatting_range formatting;