mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 11:17:35 +02:00
Simplify make_format_args
This commit is contained in:
@ -2877,8 +2877,6 @@ struct formatter<T, Char,
|
|||||||
# define FMT_CUSTOM , detail::custom_tag()
|
# define FMT_CUSTOM , detail::custom_tag()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T> constexpr T& identity(T& x) { return x; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an object that stores references to arguments and can be
|
* Constructs an object that stores references to arguments and can be
|
||||||
* implicitly converted to `format_args`. `Context` can be omitted in which case
|
* implicitly converted to `format_args`. `Context` can be omitted in which case
|
||||||
@ -2889,27 +2887,13 @@ template <typename T> constexpr T& identity(T& x) { return x; }
|
|||||||
template <typename Context = context, typename... T,
|
template <typename Context = context, typename... T,
|
||||||
size_t NUM_ARGS = sizeof...(T),
|
size_t NUM_ARGS = sizeof...(T),
|
||||||
size_t NUM_NAMED_ARGS = detail::count_named_args<T...>(),
|
size_t NUM_NAMED_ARGS = detail::count_named_args<T...>(),
|
||||||
unsigned long long DESC = detail::make_descriptor<Context, T...>(),
|
unsigned long long DESC = detail::make_descriptor<Context, T...>()>
|
||||||
FMT_ENABLE_IF(NUM_NAMED_ARGS == 0)>
|
|
||||||
constexpr FMT_ALWAYS_INLINE auto make_format_args(T&... args)
|
constexpr FMT_ALWAYS_INLINE auto make_format_args(T&... args)
|
||||||
-> detail::format_arg_store<Context, NUM_ARGS, 0, DESC> {
|
-> detail::format_arg_store<Context, NUM_ARGS, NUM_NAMED_ARGS, DESC> {
|
||||||
FMT_GCC_PRAGMA(GCC diagnostic ignored "-Wconversion")
|
FMT_GCC_PRAGMA(GCC diagnostic ignored "-Wconversion")
|
||||||
return {{args...}};
|
return {{args...}};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef FMT_DOC
|
|
||||||
template <typename Context = context, typename... T,
|
|
||||||
size_t NUM_NAMED_ARGS = detail::count_named_args<T...>(),
|
|
||||||
unsigned long long DESC =
|
|
||||||
detail::make_descriptor<Context, T...>() |
|
|
||||||
static_cast<unsigned long long>(detail::has_named_args_bit),
|
|
||||||
FMT_ENABLE_IF(NUM_NAMED_ARGS != 0)>
|
|
||||||
constexpr auto make_format_args(T&... args)
|
|
||||||
-> detail::format_arg_store<Context, sizeof...(T), NUM_NAMED_ARGS, DESC> {
|
|
||||||
return {{args...}};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
using vargs =
|
using vargs =
|
||||||
detail::format_arg_store<context, sizeof...(T),
|
detail::format_arg_store<context, sizeof...(T),
|
||||||
|
Reference in New Issue
Block a user