diff --git a/include/fmt/base.h b/include/fmt/base.h index 0c460624..1aaa8fa0 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -1120,10 +1120,8 @@ struct unformattable {}; struct unformattable_char : unformattable {}; struct unformattable_pointer : unformattable {}; -#define FMT_MAP_API static FMT_CONSTEXPR FMT_ALWAYS_INLINE - -// Maps formatting arguments to reduce the set of types we need to work with. -// Returns unformattable* on errors to be SFINAE-friendly. +// Maps formatting argument types to reduce the set of types we need to work +// with. Returns unformattable* on errors to be SFINAE-friendly. template struct arg_mapper { static auto map(signed char) -> int; static auto map(unsigned char) -> unsigned; @@ -1173,9 +1171,7 @@ template struct arg_mapper { static auto map(const T&) -> unformattable_pointer; template ::value)> - FMT_MAP_API auto map(const T (&x)[N]) -> const T (&)[N] { - return x; - } + static auto map(const T (&)[N]) -> const T (&)[N]; template ::value)> static auto map(const T& x) -> decltype(map(format_as(x))); @@ -1187,13 +1183,9 @@ template struct arg_mapper { !std::is_const::value)> {}; template ::value)> - FMT_MAP_API auto do_map(T& x) -> T& { - return x; - } + static auto do_map(T& x) -> T&; template ::value)> - FMT_MAP_API auto do_map(T&) -> unformattable { - return {}; - } + static auto do_map(T&) -> unformattable; // is_fundamental is used to allow formatters for extended FP types. template , @@ -1203,14 +1195,12 @@ template struct arg_mapper { !has_to_string_view::value && !is_char::value && !is_named_arg::value && !std::is_integral::value && !use_format_as::value)> - FMT_MAP_API auto map(T& x) -> decltype(do_map(x)) { - return do_map(x); - } + static auto map(T& x) -> decltype(do_map(x)); template ::value)> static auto map(const T& named_arg) -> decltype(map(named_arg.value)); - FMT_MAP_API auto map(...) -> unformattable { return {}; } + static auto map(...) -> unformattable; }; // detail:: is used to workaround a bug in MSVC 2017.