use named arg with static name in compile-time API

to get arg index by name at compile-time
This commit is contained in:
Alexey Ochapov
2021-04-18 13:59:24 +03:00
committed by Victor Zverovich
parent ce6e7d8620
commit ca821982ee
4 changed files with 115 additions and 39 deletions

View File

@@ -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));