mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
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,
|
||||
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(
|
||||
std::chrono::duration<Rep, Period> d) {
|
||||
auto s = std::chrono::duration_cast<std::chrono::seconds>(d);
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(d - s);
|
||||
}
|
||||
|
||||
template <
|
||||
typename Rep, typename Period,
|
||||
typename std::enable_if<std::is_floating_point<Rep>::value, int>::type = 0>
|
||||
template <typename Rep, typename Period,
|
||||
FMT_ENABLE_IF(std::is_floating_point<Rep>::value)>
|
||||
inline std::chrono::duration<Rep, std::milli> get_milliseconds(
|
||||
std::chrono::duration<Rep, Period> d) {
|
||||
return std::chrono::duration<Rep, std::milli>(
|
||||
|
@ -3047,9 +3047,9 @@ class format_int {
|
||||
|
||||
// Formatter of objects of type T.
|
||||
template <typename T, typename Char>
|
||||
struct formatter<T, Char,
|
||||
typename std::enable_if<internal::format_type<
|
||||
buffer_context<Char>, T>::value>::type> {
|
||||
struct formatter<
|
||||
T, Char,
|
||||
enable_if_t<internal::format_type<buffer_context<Char>, T>::value>> {
|
||||
FMT_CONSTEXPR formatter() : format_str_(nullptr) {}
|
||||
|
||||
// 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<<.
|
||||
template <typename T, typename Char>
|
||||
struct fallback_formatter<
|
||||
T, Char,
|
||||
typename std::enable_if<internal::is_streamable<T, Char>::value>::type>
|
||||
struct fallback_formatter<T, Char,
|
||||
enable_if_t<internal::is_streamable<T, Char>::value>>
|
||||
: formatter<basic_string_view<Char>, Char> {
|
||||
template <typename Context>
|
||||
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
|
||||
// function (not a member of std::ostream).
|
||||
template <typename T, typename Char>
|
||||
struct convert_to_int<
|
||||
T, Char,
|
||||
typename std::enable_if<internal::is_streamable<T, Char>::value>::type> {
|
||||
struct convert_to_int<T, Char,
|
||||
enable_if_t<internal::is_streamable<T, Char>::value>> {
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
|
@ -194,9 +194,7 @@ template <typename T> struct is_tuple_like {
|
||||
};
|
||||
|
||||
template <typename TupleT, typename Char>
|
||||
struct formatter<
|
||||
TupleT, Char,
|
||||
typename std::enable_if<fmt::is_tuple_like<TupleT>::value>::type> {
|
||||
struct formatter<TupleT, Char, enable_if_t<fmt::is_tuple_like<TupleT>::value>> {
|
||||
private:
|
||||
// C++11 generic lambda for format()
|
||||
template <typename FormatContext> struct format_each {
|
||||
@ -250,8 +248,7 @@ template <typename T> struct is_range {
|
||||
};
|
||||
|
||||
template <typename RangeT, typename Char>
|
||||
struct formatter<RangeT, Char,
|
||||
typename std::enable_if<fmt::is_range<RangeT>::value>::type> {
|
||||
struct formatter<RangeT, Char, enable_if_t<fmt::is_range<RangeT>::value>> {
|
||||
formatting_range<Char> formatting;
|
||||
|
||||
template <typename ParseContext>
|
||||
|
Loading…
Reference in New Issue
Block a user