mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-28 13:19:48 +01:00
use named arg with static name in compile-time API
to get arg index by name at compile-time
This commit is contained in:
committed by
Victor Zverovich
parent
ce6e7d8620
commit
ca821982ee
@@ -3941,6 +3941,9 @@ template <typename Char> struct udl_formatter {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename = void>
|
||||
struct is_statically_named_arg : std::false_type {};
|
||||
|
||||
# if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
||||
template <typename T, typename Char, size_t N, fixed_string<Char, N> Str>
|
||||
struct statically_named_arg : view {
|
||||
@@ -3953,6 +3956,10 @@ struct statically_named_arg : view {
|
||||
template <typename T, typename Char, size_t N, fixed_string<Char, N> Str>
|
||||
struct is_named_arg<statically_named_arg<T, Char, N, Str>> : std::true_type {};
|
||||
|
||||
template <typename T, typename Char, size_t N, fixed_string<Char, N> Str>
|
||||
struct is_statically_named_arg<statically_named_arg<T, Char, N, Str>>
|
||||
: std::true_type {};
|
||||
|
||||
template <typename Char, size_t N, fixed_string<Char, N> Str> struct udl_arg {
|
||||
template <typename T> auto operator=(T&& value) const {
|
||||
return statically_named_arg<T, Char, N, Str>(std::forward<T>(value));
|
||||
|
||||
Reference in New Issue
Block a user