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 authored and Victor Zverovich committed 2021-04-25 07:53:49 -07:00
1 parent ce6e7d8620
commit ca821982ee
4 files changed
+115 -39

No files matched your search

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