Skip to content

Commit f57227a

Browse files
committed
FMT_ENABLE_IF -> enable_if_t
1 parent 634f707 commit f57227a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

include/fmt/core.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,6 @@
187187
# define FMT_ASSERT(condition, message) assert((condition) && message)
188188
#endif
189189

190-
// An enable_if helper to be used in template parameters. enable_if in template
191-
// parameters results in much shorter symbols: https://godbolt.org/z/sWw4vP.
192-
#define FMT_ENABLE_IF_T(...) typename std::enable_if<(__VA_ARGS__), int>::type
193-
#define FMT_ENABLE_IF(...) FMT_ENABLE_IF_T(__VA_ARGS__) = 0
194-
195190
// libc++ supports string_view in pre-c++17.
196191
#if (FMT_HAS_INCLUDE(<string_view>) && \
197192
(__cplusplus > 201402L || defined(_LIBCPP_VERSION))) || \
@@ -215,6 +210,11 @@ using std_string_view = std::experimental::basic_string_view<Char>;
215210
template <typename T> struct std_string_view {};
216211
#endif
217212

213+
// An enable_if helper to be used in template parameters. enable_if in template
214+
// parameters results in much shorter symbols: https://godbolt.org/z/sWw4vP.
215+
template <bool B> using enable_if_t = typename std::enable_if<B, int>::type;
216+
#define FMT_ENABLE_IF(...) internal::enable_if_t<__VA_ARGS__> = 0
217+
218218
#if (__cplusplus >= 201703L || \
219219
(defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && \
220220
__cpp_lib_is_invocable >= 201703L

include/fmt/format-inl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ template <typename Locale> Locale locale_ref::get() const {
223223
}
224224

225225
template <typename Char> FMT_FUNC Char thousands_sep_impl(locale_ref loc) {
226-
return std::use_facet<std::numpunct<Char> >(loc.get<std::locale>())
226+
return std::use_facet<std::numpunct<Char>>(loc.get<std::locale>())
227227
.thousands_sep();
228228
}
229229
} // namespace internal
@@ -683,7 +683,7 @@ template <int GRISU_VERSION> struct grisu_shortest_handler {
683683
}
684684
};
685685

686-
template <typename Double, FMT_ENABLE_IF_T(sizeof(Double) == sizeof(uint64_t))>
686+
template <typename Double, enable_if_t<sizeof(Double) == sizeof(uint64_t)>>
687687
FMT_API bool grisu_format(Double value, buffer<char>& buf, int precision,
688688
unsigned options, int& exp) {
689689
FMT_ASSERT(value >= 0, "value is negative");

include/fmt/format.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2238,7 +2238,7 @@ FMT_CONSTEXPR bool do_check_format_string(basic_string_view<Char> s,
22382238
}
22392239

22402240
template <typename... Args, typename S,
2241-
FMT_ENABLE_IF_T(is_compile_string<S>::value)>
2241+
internal::enable_if_t<is_compile_string<S>::value>>
22422242
void check_format_string(S format_str) {
22432243
typedef typename S::char_type char_t;
22442244
FMT_CONSTEXPR_DECL bool invalid_format =

0 commit comments

Comments
 (0)