Rename check to fmt_check (fixes #2965) so that it works with unreal engine

Fixes https://github.com/fmtlib/fmt/issues/2965
This commit is contained in:
Daniel Butum 2022-11-22 12:34:06 +02:00
parent 3160847ebd
commit 087b0fafd1
3 changed files with 19 additions and 19 deletions

View File

@ -1354,10 +1354,10 @@ inline auto format_as(std::byte b) -> unsigned char {
template <typename T> struct has_format_as {
template <typename U, typename V = decltype(format_as(U())),
FMT_ENABLE_IF(std::is_enum<U>::value&& std::is_integral<V>::value)>
static auto check(U*) -> std::true_type;
static auto check(...) -> std::false_type;
static auto fmt_check(U*) -> std::true_type;
static auto fmt_check(...) -> std::false_type;
enum { value = decltype(check(static_cast<T*>(nullptr)))::value };
enum { value = decltype(fmt_check(static_cast<T*>(nullptr)))::value };
};
// Maps formatting arguments to core types.

View File

@ -50,43 +50,43 @@ OutputIterator copy(wchar_t ch, OutputIterator out) {
// Returns true if T has a std::string-like interface, like std::string_view.
template <typename T> class is_std_string_like {
template <typename U>
static auto check(U* p)
static auto fmt_check(U* p)
-> decltype((void)p->find('a'), p->length(), (void)p->data(), int());
template <typename> static void check(...);
template <typename> static void fmt_check(...);
public:
static constexpr const bool value =
is_string<T>::value ||
std::is_convertible<T, std_string_view<char>>::value ||
!std::is_void<decltype(check<T>(nullptr))>::value;
!std::is_void<decltype(fmt_check<T>(nullptr))>::value;
};
template <typename Char>
struct is_std_string_like<fmt::basic_string_view<Char>> : std::true_type {};
template <typename T> class is_map {
template <typename U> static auto check(U*) -> typename U::mapped_type;
template <typename> static void check(...);
template <typename U> static auto fmt_check(U*) -> typename U::mapped_type;
template <typename> static void fmt_check(...);
public:
#ifdef FMT_FORMAT_MAP_AS_LIST
static constexpr const bool value = false;
#else
static constexpr const bool value =
!std::is_void<decltype(check<T>(nullptr))>::value;
!std::is_void<decltype(fmt_check<T>(nullptr))>::value;
#endif
};
template <typename T> class is_set {
template <typename U> static auto check(U*) -> typename U::key_type;
template <typename> static void check(...);
template <typename U> static auto fmt_check(U*) -> typename U::key_type;
template <typename> static void fmt_check(...);
public:
#ifdef FMT_FORMAT_SET_AS_LIST
static constexpr const bool value = false;
#else
static constexpr const bool value =
!std::is_void<decltype(check<T>(nullptr))>::value && !is_map<T>::value;
!std::is_void<decltype(fmt_check<T>(nullptr))>::value && !is_map<T>::value;
#endif
};
@ -170,12 +170,12 @@ struct is_range_<T, void>
// tuple_size and tuple_element check.
template <typename T> class is_tuple_like_ {
template <typename U>
static auto check(U* p) -> decltype(std::tuple_size<U>::value, int());
template <typename> static void check(...);
static auto fmt_check(U* p) -> decltype(std::tuple_size<U>::value, int());
template <typename> static void fmt_check(...);
public:
static constexpr const bool value =
!std::is_void<decltype(check<T>(nullptr))>::value;
!std::is_void<decltype(fmt_check<T>(nullptr))>::value;
};
// Check for integer_sequence
@ -220,11 +220,11 @@ template <typename T, typename C> class is_tuple_formattable_<T, C, true> {
index_sequence<Is...>{},
integer_sequence<
bool, (is_formattable<typename std::tuple_element<Is, T>::type,
C>::value)...>{})) check(index_sequence<Is...>);
C>::value)...>{})) fmt_check(index_sequence<Is...>);
public:
static constexpr const bool value =
decltype(check(tuple_index_sequence<T>{}))::value;
decltype(fmt_check(tuple_index_sequence<T>{}))::value;
};
template <class Tuple, class F, size_t... Is>

View File

@ -123,11 +123,11 @@ template <typename T, typename C> class is_variant_formattable_ {
template <std::size_t... Is>
static std::conjunction<
is_formattable<std::variant_alternative_t<Is, T>, C>...>
check(std::index_sequence<Is...>);
fmt_check(std::index_sequence<Is...>);
public:
static constexpr const bool value =
decltype(check(variant_index_sequence<T>{}))::value;
decltype(fmt_check(variant_index_sequence<T>{}))::value;
};
template <typename Char, typename OutputIt, typename T>