mirror of
https://github.com/fmtlib/fmt.git
synced 2026-05-05 03:54:10 +02:00
Range support
This commit is contained in:
+10
-1
@@ -1198,7 +1198,11 @@ template <typename Context> struct arg_mapper {
|
||||
FMT_CONSTEXPR const void* map(void* val) { return val; }
|
||||
FMT_CONSTEXPR const void* map(const void* val) { return val; }
|
||||
FMT_CONSTEXPR const void* map(std::nullptr_t val) { return val; }
|
||||
template <typename T> FMT_CONSTEXPR int map(const T*) {
|
||||
|
||||
// We use SFINAE instead of a const T* parameter to avoid conflicting with
|
||||
// the C array overload.
|
||||
template <typename T>
|
||||
FMT_CONSTEXPR auto map(T) -> enable_if_t<std::is_pointer<T>::value, int> {
|
||||
// Formatting of arbitrary pointers is disallowed. If you want to output
|
||||
// a pointer cast it to "void *" or "const void *". In particular, this
|
||||
// forbids formatting of "[const] volatile char *" which is printed as bool
|
||||
@@ -1207,6 +1211,11 @@ template <typename Context> struct arg_mapper {
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
FMT_CONSTEXPR auto map(const T (&values)[N]) -> const T (&)[N] {
|
||||
return values;
|
||||
}
|
||||
|
||||
template <typename T,
|
||||
FMT_ENABLE_IF(std::is_enum<T>::value &&
|
||||
!has_formatter<T, Context>::value &&
|
||||
|
||||
Reference in New Issue
Block a user