Remove unwrap_named_arg

This commit is contained in:
Victor Zverovich
2024-09-16 20:42:41 -07:00
parent 497df6db61
commit 239aa6911b

View File

@@ -1027,20 +1027,9 @@ template <typename Char, typename T> struct named_arg : view {
const T& value; const T& value;
named_arg(const Char* n, const T& v) : name(n), value(v) {} named_arg(const Char* n, const T& v) : name(n), value(v) {}
static_assert(!is_named_arg<T>::value, "nested named arguments"); static_assert(!is_named_arg<T>::value, "nested named arguments");
}; };
template <typename Char, typename T>
auto unwrap_named_arg(const named_arg<Char, T>& arg) -> const T& {
return arg.value;
}
template <typename T,
FMT_ENABLE_IF(!is_named_arg<remove_reference_t<T>>::value)>
auto unwrap_named_arg(T&& value) -> T&& {
return value;
}
template <bool B = false> constexpr auto count() -> size_t { return B ? 1 : 0; } template <bool B = false> constexpr auto count() -> size_t { return B ? 1 : 0; }
template <bool B1, bool B2, bool... Tail> constexpr auto count() -> size_t { template <bool B1, bool B2, bool... Tail> constexpr auto count() -> size_t {
return (B1 ? 1 : 0) + count<B2, Tail...>(); return (B1 ? 1 : 0) + count<B2, Tail...>();
@@ -2181,7 +2170,7 @@ template <typename Context> class value {
private: private:
template <typename T, FMT_ENABLE_IF(has_formatter<T, char_type>())> template <typename T, FMT_ENABLE_IF(has_formatter<T, char_type>())>
FMT_CONSTEXPR value(T& x, custom_tag) { FMT_CONSTEXPR value(T& x, custom_tag) {
using value_type = remove_cvref_t<T>; using value_type = remove_const_t<T>;
// T may overload operator& e.g. std::vector<bool>::reference in libc++. // T may overload operator& e.g. std::vector<bool>::reference in libc++.
if (!is_constant_evaluated()) { if (!is_constant_evaluated()) {
custom.value = custom.value =