forked from fmtlib/fmt
Refactor problematic trailing returns in arg_mapper
This commit is contained in:
@ -8,8 +8,8 @@
|
|||||||
#ifndef FMT_CORE_H_
|
#ifndef FMT_CORE_H_
|
||||||
#define FMT_CORE_H_
|
#define FMT_CORE_H_
|
||||||
|
|
||||||
#include <cstddef> // std::byte
|
#include <cstddef> // std::byte
|
||||||
#include <cstdio> // std::FILE
|
#include <cstdio> // std::FILE
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
@ -1364,20 +1364,21 @@ template <typename Context> struct arg_mapper {
|
|||||||
-> basic_string_view<char_type> {
|
-> basic_string_view<char_type> {
|
||||||
return std_string_view<char_type>(val);
|
return std_string_view<char_type>(val);
|
||||||
}
|
}
|
||||||
FMT_CONSTEXPR FMT_INLINE auto map(const signed char* val)
|
|
||||||
-> decltype(this->map("")) {
|
using cstring_result = conditional_t<std::is_same<char_type, char>::value,
|
||||||
|
const char*, unformattable_pointer>;
|
||||||
|
|
||||||
|
FMT_CONSTEXPR FMT_INLINE auto map(const signed char* val) -> cstring_result {
|
||||||
return map(reinterpret_cast<const char*>(val));
|
return map(reinterpret_cast<const char*>(val));
|
||||||
}
|
}
|
||||||
FMT_CONSTEXPR FMT_INLINE auto map(const unsigned char* val)
|
FMT_CONSTEXPR FMT_INLINE auto map(const unsigned char* val)
|
||||||
-> decltype(this->map("")) {
|
-> cstring_result {
|
||||||
return map(reinterpret_cast<const char*>(val));
|
return map(reinterpret_cast<const char*>(val));
|
||||||
}
|
}
|
||||||
FMT_CONSTEXPR FMT_INLINE auto map(signed char* val)
|
FMT_CONSTEXPR FMT_INLINE auto map(signed char* val) -> cstring_result {
|
||||||
-> decltype(this->map("")) {
|
|
||||||
return map(reinterpret_cast<const char*>(val));
|
return map(reinterpret_cast<const char*>(val));
|
||||||
}
|
}
|
||||||
FMT_CONSTEXPR FMT_INLINE auto map(unsigned char* val)
|
FMT_CONSTEXPR FMT_INLINE auto map(unsigned char* val) -> cstring_result {
|
||||||
-> decltype(this->map("")) {
|
|
||||||
return map(reinterpret_cast<const char*>(val));
|
return map(reinterpret_cast<const char*>(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1410,9 +1411,8 @@ template <typename Context> struct arg_mapper {
|
|||||||
|
|
||||||
template <typename T,
|
template <typename T,
|
||||||
FMT_ENABLE_IF(std::is_enum<T>::value &&
|
FMT_ENABLE_IF(std::is_enum<T>::value &&
|
||||||
(std::is_convertible<T, int>::value
|
(std::is_convertible<T, int>::value ||
|
||||||
|| std::is_same<T, detail::byte>::value
|
std::is_same<T, detail::byte>::value) &&
|
||||||
) &&
|
|
||||||
!has_formatter<T, Context>::value &&
|
!has_formatter<T, Context>::value &&
|
||||||
!has_fallback_formatter<T, char_type>::value)>
|
!has_fallback_formatter<T, char_type>::value)>
|
||||||
FMT_CONSTEXPR FMT_INLINE auto map(const T& val)
|
FMT_CONSTEXPR FMT_INLINE auto map(const T& val)
|
||||||
|
Reference in New Issue
Block a user