Refactor problematic trailing returns in arg_mapper

This commit is contained in:
Victor Zverovich 2021-12-09 18:08:22 -08:00
parent fd62fba985
commit ac1b5f3da5

View File

@ -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)