Fix template argument ordering

This commit is contained in:
Victor Zverovich 2026-02-02 10:44:37 -08:00
parent d04c9801a7
commit 39e15aff74
4 changed files with 8 additions and 9 deletions

View File

@ -114,7 +114,7 @@ FMT_EXPORT template <typename Context> class dynamic_format_arg_store {
} }
template <typename T> template <typename T>
void emplace_arg(const detail::named_arg<char_type, T>& arg) { void emplace_arg(const detail::named_arg<T, char_type>& arg) {
if (named_info_.empty()) if (named_info_.empty())
data_.insert(data_.begin(), basic_format_arg<Context>(nullptr, 0)); data_.insert(data_.begin(), basic_format_arg<Context>(nullptr, 0));
data_.emplace_back(detail::unwrap(arg.value)); data_.emplace_back(detail::unwrap(arg.value));
@ -184,7 +184,7 @@ FMT_EXPORT template <typename Context> class dynamic_format_arg_store {
* copying of the argument. The name is always copied into the store. * copying of the argument. The name is always copied into the store.
*/ */
template <typename T> template <typename T>
void push_back(const detail::named_arg<char_type, T>& arg) { void push_back(const detail::named_arg<T, char_type>& arg) {
const char_type* arg_name = const char_type* arg_name =
dynamic_args_.push<std::basic_string<char_type>>(arg.name).c_str(); dynamic_args_.push<std::basic_string<char_type>>(arg.name).c_str();
if FMT_CONSTEXPR20 (need_copy<T>::value) { if FMT_CONSTEXPR20 (need_copy<T>::value) {

View File

@ -1031,14 +1031,14 @@ struct is_view : std::false_type {};
template <typename T> template <typename T>
struct is_view<T, bool_constant<sizeof(T) != 0>> : std::is_base_of<view, T> {}; struct is_view<T, bool_constant<sizeof(T) != 0>> : std::is_base_of<view, T> {};
template <typename Char, typename T> struct named_arg; template <typename T, typename Char> struct named_arg;
template <typename T> struct is_named_arg : std::false_type {}; template <typename T> struct is_named_arg : std::false_type {};
template <typename T> struct is_static_named_arg : std::false_type {}; template <typename T> struct is_static_named_arg : std::false_type {};
template <typename Char, typename T> template <typename Char, typename T>
struct is_named_arg<named_arg<Char, T>> : std::true_type {}; struct is_named_arg<named_arg<T, Char>> : std::true_type {};
template <typename Char, typename T> struct named_arg : view { template <typename T, typename Char = char> struct named_arg : view {
const Char* name; const Char* name;
const T& value; const T& value;
@ -2719,7 +2719,7 @@ using vargs =
* sufficiently new compilers. See `operator""_a()`. * sufficiently new compilers. See `operator""_a()`.
*/ */
template <typename Char, typename T> template <typename Char, typename T>
inline auto arg(const Char* name, const T& arg) -> detail::named_arg<Char, T> { inline auto arg(const Char* name, const T& arg) -> detail::named_arg<T, Char> {
return {name, arg}; return {name, arg};
} }

View File

@ -3861,7 +3861,7 @@ struct udl_arg {
template <typename Char> struct udl_arg { template <typename Char> struct udl_arg {
const Char* str; const Char* str;
template <typename T> auto operator=(T&& value) const -> named_arg<Char, T> { template <typename T> auto operator=(T&& value) const -> named_arg<T, Char> {
return {str, std::forward<T>(value)}; return {str, std::forward<T>(value)};
} }
}; };

View File

@ -760,8 +760,7 @@ template <typename Container> struct all {
* formatted as the underlying container. * formatted as the underlying container.
*/ */
FMT_EXPORT FMT_EXPORT
template <typename T> template <typename T> struct is_container_adaptor {
struct is_container_adaptor {
private: private:
template <typename U> static auto check(U* p) -> typename U::container_type; template <typename U> static auto check(U* p) -> typename U::container_type;
template <typename> static void check(...); template <typename> static void check(...);