Using FMT_CONSTEXPR_DECL for variables.

Replaced std::enable_if_t by std::std::enable_if<>::type.
Replaced variable templates by structs.
This commit is contained in:
Remotion 2018-05-13 00:04:30 +02:00
parent f101d62833
commit 7a2099e7de

View File

@ -35,7 +35,7 @@ struct formatting_range : formatting_base<Char> {
Char prefix = '{'; Char prefix = '{';
Char delimiter = ','; Char delimiter = ',';
Char postfix = '}'; Char postfix = '}';
static FMT_CONSTEXPR bool add_spaces = false; static FMT_CONSTEXPR_DECL const bool add_spaces = false;
}; };
template <typename Char, typename Enable = void> template <typename Char, typename Enable = void>
@ -43,7 +43,7 @@ struct formatting_tuple : formatting_base<Char> {
Char prefix = '['; Char prefix = '[';
Char delimiter = ','; Char delimiter = ',';
Char postfix = ']'; Char postfix = ']';
static FMT_CONSTEXPR bool add_spaces = false; static FMT_CONSTEXPR_DECL const bool add_spaces = false;
}; };
namespace internal { namespace internal {
@ -81,11 +81,9 @@ class is_like_std_string {
static void check(...); static void check(...);
public: public:
static FMT_CONSTEXPR bool value = !std::is_void<decltype(check<T>(nullptr))>::value; static FMT_CONSTEXPR_DECL const bool value = !std::is_void<decltype(check<T>(nullptr))>::value;
}; };
template <typename T>
FMT_CONSTEXPR bool is_like_std_string_v = is_like_std_string<T>::value;
template <typename... Ts> template <typename... Ts>
struct conditional_helper {}; struct conditional_helper {};
@ -100,7 +98,10 @@ struct is_range_<T, std::conditional_t<false,
void>> : std::true_type {}; void>> : std::true_type {};
template <typename T> template <typename T>
FMT_CONSTEXPR bool is_range_v = is_range_<T>::value && !is_like_std_string<T>::value; struct is_range {
static FMT_CONSTEXPR_DECL const bool value = is_range_<T>::value && !is_like_std_string<T>::value;
};
/// tuple_size and tuple_element check. /// tuple_size and tuple_element check.
template <typename T> template <typename T>
@ -113,11 +114,13 @@ class is_tuple_like_ {
static void check(...); static void check(...);
public: public:
static FMT_CONSTEXPR bool value = !std::is_void<decltype(check<T>(nullptr))>::value; static FMT_CONSTEXPR_DECL const bool value = !std::is_void<decltype(check<T>(nullptr))>::value;
}; };
template <typename T> template <typename T>
FMT_CONSTEXPR bool is_tuple_like_v = is_tuple_like_<T>::value && !is_range_<T>::value; struct is_tuple_like {
static FMT_CONSTEXPR_DECL const bool value = is_tuple_like_<T>::value && !is_range_<T>::value;
};
//=-------------------------------------------------------------------------------------------------------------------- //=--------------------------------------------------------------------------------------------------------------------
template <size_t... Is, class Tuple, class F> template <size_t... Is, class Tuple, class F>
@ -143,7 +146,8 @@ void for_each(Tuple &&tup, F &&f) {
// ===================================================================================================================== // =====================================================================================================================
template <typename TupleT, typename Char> template <typename TupleT, typename Char>
struct formatter<TupleT, Char, std::enable_if_t<fmt::internal::is_tuple_like_v<TupleT>>> { struct formatter<TupleT, Char,
typename std::enable_if<fmt::internal::is_tuple_like<TupleT>::value>::type> {
fmt::formatting_tuple<Char> formatting; fmt::formatting_tuple<Char> formatting;
@ -177,10 +181,11 @@ struct formatter<TupleT, Char, std::enable_if_t<fmt::internal::is_tuple_like_v<T
}; };
template <typename RangeT, typename Char> template <typename RangeT, typename Char>
struct formatter<RangeT, Char, std::enable_if_t<fmt::internal::is_range_v<RangeT>>> { struct formatter< RangeT, Char,
typename std::enable_if<fmt::internal::is_range<RangeT>::value>::type> {
static FMT_CONSTEXPR std::size_t range_length_limit = 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_RANGE_OUTPUT_LENGTH_LIMIT; // output only up to N items from the range.
fmt::formatting_range<Char> formatting; fmt::formatting_range<Char> formatting;