mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
Refactor problematic trailing returns in arg_mapper
This commit is contained in:
parent
fd62fba985
commit
ac1b5f3da5
@ -8,8 +8,8 @@
|
||||
#ifndef FMT_CORE_H_
|
||||
#define FMT_CORE_H_
|
||||
|
||||
#include <cstddef> // std::byte
|
||||
#include <cstdio> // std::FILE
|
||||
#include <cstddef> // std::byte
|
||||
#include <cstdio> // std::FILE
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
@ -1364,20 +1364,21 @@ template <typename Context> struct arg_mapper {
|
||||
-> basic_string_view<char_type> {
|
||||
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));
|
||||
}
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(const unsigned char* val)
|
||||
-> decltype(this->map("")) {
|
||||
-> cstring_result {
|
||||
return map(reinterpret_cast<const char*>(val));
|
||||
}
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(signed char* val)
|
||||
-> decltype(this->map("")) {
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(signed char* val) -> cstring_result {
|
||||
return map(reinterpret_cast<const char*>(val));
|
||||
}
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(unsigned char* val)
|
||||
-> decltype(this->map("")) {
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(unsigned char* val) -> cstring_result {
|
||||
return map(reinterpret_cast<const char*>(val));
|
||||
}
|
||||
|
||||
@ -1410,9 +1411,8 @@ template <typename Context> struct arg_mapper {
|
||||
|
||||
template <typename T,
|
||||
FMT_ENABLE_IF(std::is_enum<T>::value &&
|
||||
(std::is_convertible<T, int>::value
|
||||
|| std::is_same<T, detail::byte>::value
|
||||
) &&
|
||||
(std::is_convertible<T, int>::value ||
|
||||
std::is_same<T, detail::byte>::value) &&
|
||||
!has_formatter<T, Context>::value &&
|
||||
!has_fallback_formatter<T, char_type>::value)>
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(const T& val)
|
||||
|
Loading…
Reference in New Issue
Block a user