arg_mapper -> type_mapper

This commit is contained in:
Victor Zverovich 2024-09-15 17:09:49 -07:00
parent e97df46ae1
commit 8a19b2db77
3 changed files with 5 additions and 17 deletions

View File

@ -1125,9 +1125,9 @@ constexpr auto has_const_formatter() -> bool {
struct unformattable {};
// Maps formatting argument types to a smaller set. Returns unformattable* on
// Maps formatting argument types to a smaller set. Returns unformattable on
// errors to be SFINAE-friendly.
template <typename Char> struct arg_mapper {
template <typename Char> struct type_mapper {
static auto map(signed char) -> int;
static auto map(unsigned char) -> unsigned;
static auto map(short) -> int;
@ -1197,9 +1197,9 @@ template <typename Char> struct arg_mapper {
// detail:: is used to workaround a bug in MSVC 2017.
template <typename T, typename Char>
using mapped_t = decltype(detail::arg_mapper<Char>::map(std::declval<T&>()));
using mapped_t = decltype(detail::type_mapper<Char>::map(std::declval<T&>()));
// A type constant after applying arg_mapper.
// A type constant after applying type_mapper.
template <typename T, typename Char = char>
using mapped_type_constant = type_constant<mapped_t<T, Char>, Char>;

View File

@ -3602,18 +3602,6 @@ auto write(OutputIt out, const T* value, const format_specs& specs = {},
return write_ptr<Char>(out, bit_cast<uintptr_t>(value), &specs);
}
// A write overload that handles implicit conversions.
template <typename Char, typename OutputIt, typename T,
typename Context = basic_format_context<OutputIt, Char>>
FMT_CONSTEXPR auto write(OutputIt out, const T& value) -> enable_if_t<
std::is_class<T>::value && !has_to_string_view<T>::value &&
!is_floating_point<T>::value && !std::is_same<T, Char>::value &&
!std::is_same<
T, remove_cvref_t<decltype(arg_mapper<Char>::map(value))>>::value,
OutputIt> {
return write<Char>(out, arg_mapper<Char>::map(value));
}
template <typename Char, typename OutputIt, typename T,
FMT_ENABLE_IF(mapped_type_constant<T, Char>::value ==
type::custom_type &&

View File

@ -351,7 +351,7 @@ template <typename T, typename Char> struct is_range {
namespace detail {
template <typename Context> struct range_mapper {
using mapper = arg_mapper<typename Context::char_type>;
using mapper = type_mapper<typename Context::char_type>;
using char_type = typename Context::char_type;
template <typename T,