Skip to content

Commit

Permalink
arg_mapper -> type_mapper
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Sep 16, 2024
1 parent e97df46 commit 8a19b2d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
8 changes: 4 additions & 4 deletions include/fmt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>;

Expand Down
12 changes: 0 additions & 12 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
2 changes: 1 addition & 1 deletion include/fmt/ranges.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8a19b2d

Please sign in to comment.