Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting of function pointers, member function pointers, member object pointers... #2610

Merged
merged 6 commits into from
Nov 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify more
AlexGuteniev committed Nov 23, 2021
commit 17024c259fed5e49a143f564dca3b0c5deffb91b
26 changes: 5 additions & 21 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
@@ -1368,33 +1368,17 @@ template <typename Context> struct arg_mapper {
return val;
}

template <typename T,
FMT_ENABLE_IF(
std::is_function<typename std::remove_pointer<T>::type>::value)>
FMT_CONSTEXPR auto map(const T&) -> unformattable_pointer {
return {};
}

template <typename T, FMT_ENABLE_IF(std::is_member_object_pointer<T>::value)>
FMT_CONSTEXPR auto map(const T&) -> unformattable_pointer {
return {};
}

template <typename T,
FMT_ENABLE_IF(std::is_member_function_pointer<T>::value)>
FMT_CONSTEXPR auto map(const T&) -> unformattable_pointer {
return {};
}

// We use SFINAE instead of a const T* parameter to avoid conflicting with
// the C array overload.

template <
typename T,
FMT_ENABLE_IF(
!std::is_function<typename std::remove_pointer<T>::type>::value &&
std::is_convertible<const T&, const void*>::value &&
!std::is_convertible<const T&, const char_type*>::value)>
std::is_member_object_pointer<T>::value ||
std::is_member_function_pointer<T>::value ||
std::is_function<typename std::remove_pointer<T>::type>::value ||
(std::is_convertible<const T&, const void*>::value &&
!std::is_convertible<const T&, const char_type*>::value))>
FMT_CONSTEXPR auto map(const T&) -> unformattable_pointer {
return {};
}