Use enable_if_t
This commit is contained in:
parent
d2ee5f2407
commit
469a4bbd35
@ -413,16 +413,15 @@ template <typename T> struct make_unsigned_or_unchanged<T, true> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename Rep, typename Period,
|
template <typename Rep, typename Period,
|
||||||
typename std::enable_if<std::is_integral<Rep>::value, int>::type = 0>
|
FMT_ENABLE_IF(std::is_integral<Rep>::value)>
|
||||||
inline std::chrono::duration<Rep, std::milli> get_milliseconds(
|
inline std::chrono::duration<Rep, std::milli> get_milliseconds(
|
||||||
std::chrono::duration<Rep, Period> d) {
|
std::chrono::duration<Rep, Period> d) {
|
||||||
auto s = std::chrono::duration_cast<std::chrono::seconds>(d);
|
auto s = std::chrono::duration_cast<std::chrono::seconds>(d);
|
||||||
return std::chrono::duration_cast<std::chrono::milliseconds>(d - s);
|
return std::chrono::duration_cast<std::chrono::milliseconds>(d - s);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <typename Rep, typename Period,
|
||||||
typename Rep, typename Period,
|
FMT_ENABLE_IF(std::is_floating_point<Rep>::value)>
|
||||||
typename std::enable_if<std::is_floating_point<Rep>::value, int>::type = 0>
|
|
||||||
inline std::chrono::duration<Rep, std::milli> get_milliseconds(
|
inline std::chrono::duration<Rep, std::milli> get_milliseconds(
|
||||||
std::chrono::duration<Rep, Period> d) {
|
std::chrono::duration<Rep, Period> d) {
|
||||||
return std::chrono::duration<Rep, std::milli>(
|
return std::chrono::duration<Rep, std::milli>(
|
||||||
|
@ -3047,9 +3047,9 @@ class format_int {
|
|||||||
|
|
||||||
// Formatter of objects of type T.
|
// Formatter of objects of type T.
|
||||||
template <typename T, typename Char>
|
template <typename T, typename Char>
|
||||||
struct formatter<T, Char,
|
struct formatter<
|
||||||
typename std::enable_if<internal::format_type<
|
T, Char,
|
||||||
buffer_context<Char>, T>::value>::type> {
|
enable_if_t<internal::format_type<buffer_context<Char>, T>::value>> {
|
||||||
FMT_CONSTEXPR formatter() : format_str_(nullptr) {}
|
FMT_CONSTEXPR formatter() : format_str_(nullptr) {}
|
||||||
|
|
||||||
// Parses format specifiers stopping either at the end of the range or at the
|
// Parses format specifiers stopping either at the end of the range or at the
|
||||||
|
@ -96,9 +96,8 @@ void format_value(buffer<Char>& buf, const T& value) {
|
|||||||
|
|
||||||
// Formats an object of type T that has an overloaded ostream operator<<.
|
// Formats an object of type T that has an overloaded ostream operator<<.
|
||||||
template <typename T, typename Char>
|
template <typename T, typename Char>
|
||||||
struct fallback_formatter<
|
struct fallback_formatter<T, Char,
|
||||||
T, Char,
|
enable_if_t<internal::is_streamable<T, Char>::value>>
|
||||||
typename std::enable_if<internal::is_streamable<T, Char>::value>::type>
|
|
||||||
: formatter<basic_string_view<Char>, Char> {
|
: formatter<basic_string_view<Char>, Char> {
|
||||||
template <typename Context>
|
template <typename Context>
|
||||||
auto format(const T& value, Context& ctx) -> decltype(ctx.out()) {
|
auto format(const T& value, Context& ctx) -> decltype(ctx.out()) {
|
||||||
@ -113,9 +112,8 @@ struct fallback_formatter<
|
|||||||
// Disable conversion to int if T has an overloaded operator<< which is a free
|
// Disable conversion to int if T has an overloaded operator<< which is a free
|
||||||
// function (not a member of std::ostream).
|
// function (not a member of std::ostream).
|
||||||
template <typename T, typename Char>
|
template <typename T, typename Char>
|
||||||
struct convert_to_int<
|
struct convert_to_int<T, Char,
|
||||||
T, Char,
|
enable_if_t<internal::is_streamable<T, Char>::value>> {
|
||||||
typename std::enable_if<internal::is_streamable<T, Char>::value>::type> {
|
|
||||||
static const bool value = false;
|
static const bool value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -194,9 +194,7 @@ template <typename T> struct is_tuple_like {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename TupleT, typename Char>
|
template <typename TupleT, typename Char>
|
||||||
struct formatter<
|
struct formatter<TupleT, Char, enable_if_t<fmt::is_tuple_like<TupleT>::value>> {
|
||||||
TupleT, Char,
|
|
||||||
typename std::enable_if<fmt::is_tuple_like<TupleT>::value>::type> {
|
|
||||||
private:
|
private:
|
||||||
// C++11 generic lambda for format()
|
// C++11 generic lambda for format()
|
||||||
template <typename FormatContext> struct format_each {
|
template <typename FormatContext> struct format_each {
|
||||||
@ -250,8 +248,7 @@ template <typename T> struct is_range {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename RangeT, typename Char>
|
template <typename RangeT, typename Char>
|
||||||
struct formatter<RangeT, Char,
|
struct formatter<RangeT, Char, enable_if_t<fmt::is_range<RangeT>::value>> {
|
||||||
typename std::enable_if<fmt::is_range<RangeT>::value>::type> {
|
|
||||||
formatting_range<Char> formatting;
|
formatting_range<Char> formatting;
|
||||||
|
|
||||||
template <typename ParseContext>
|
template <typename ParseContext>
|
||||||
|
Loading…
Reference in New Issue
Block a user