mirror of
https://github.com/fmtlib/fmt.git
synced 2025-01-27 06:35:37 +00:00
Make enable_if_t more std-like and move to fmt namespace
This commit is contained in:
parent
78daa50ffc
commit
67feef5589
@ -199,6 +199,11 @@
|
||||
#endif
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
|
||||
// An implementation of enable_if_t for pre-C++14 systems.
|
||||
template <bool B, class T = void>
|
||||
using enable_if_t = typename std::enable_if<B, T>::type;
|
||||
|
||||
namespace internal {
|
||||
|
||||
#if defined(FMT_USE_STRING_VIEW)
|
||||
@ -210,10 +215,9 @@ using std_string_view = std::experimental::basic_string_view<Char>;
|
||||
template <typename T> struct std_string_view {};
|
||||
#endif
|
||||
|
||||
// An enable_if helper to be used in template parameters. enable_if in template
|
||||
// parameters results in much shorter symbols: https://godbolt.org/z/sWw4vP.
|
||||
template <bool B> using enable_if_t = typename std::enable_if<B, int>::type;
|
||||
#define FMT_ENABLE_IF(...) internal::enable_if_t<__VA_ARGS__> = 0
|
||||
// An enable_if helper to be used in template parameters which results in much
|
||||
// shorter symbols: https://godbolt.org/z/sWw4vP.
|
||||
#define FMT_ENABLE_IF(...) enable_if_t<__VA_ARGS__, int> = 0
|
||||
|
||||
#if (__cplusplus >= 201703L || \
|
||||
(defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && \
|
||||
|
@ -674,7 +674,7 @@ template <int GRISU_VERSION> struct grisu_shortest_handler {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Double, enable_if_t<sizeof(Double) == sizeof(uint64_t)>>
|
||||
template <typename Double, enable_if_t<sizeof(Double) == sizeof(uint64_t), int>>
|
||||
FMT_API bool grisu_format(Double value, buffer<char>& buf, int precision,
|
||||
unsigned options, int& exp) {
|
||||
FMT_ASSERT(value >= 0, "value is negative");
|
||||
|
@ -2245,7 +2245,7 @@ FMT_CONSTEXPR bool do_check_format_string(basic_string_view<Char> s,
|
||||
}
|
||||
|
||||
template <typename... Args, typename S,
|
||||
internal::enable_if_t<is_compile_string<S>::value>>
|
||||
enable_if_t<is_compile_string<S>::value, int>>
|
||||
void check_format_string(S format_str) {
|
||||
typedef typename S::char_type char_t;
|
||||
FMT_CONSTEXPR_DECL bool invalid_format =
|
||||
|
Loading…
x
Reference in New Issue
Block a user