diff --git a/include/fmt/core.h b/include/fmt/core.h index 194b3373..7444cac6 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -197,6 +197,8 @@ template using conditional_t = typename std::conditional::type; template using bool_constant = std::integral_constant; +struct monostate {}; + // An enable_if helper to be used in template parameters which results in much // shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed // to workaround a bug in MSVC 2019 (see #1140 and #1186). @@ -844,8 +846,9 @@ template class basic_format_arg { const T& value); template - friend FMT_CONSTEXPR auto visit_format_arg( - Visitor&& vis, const basic_format_arg& arg) -> decltype(vis(0)); + friend FMT_CONSTEXPR auto visit_format_arg(Visitor&& vis, + const basic_format_arg& arg) + -> decltype(vis(0)); friend class basic_format_args; friend class internal::arg_map; @@ -877,8 +880,6 @@ template class basic_format_arg { bool is_arithmetic() const { return internal::is_arithmetic(type_); } }; -struct monostate {}; - /** \rst Visits an argument dispatching to the appropriate visit method based on @@ -887,8 +888,9 @@ struct monostate {}; \endrst */ template -FMT_CONSTEXPR auto visit_format_arg( - Visitor&& vis, const basic_format_arg& arg) -> decltype(vis(0)) { +FMT_CONSTEXPR auto visit_format_arg(Visitor&& vis, + const basic_format_arg& arg) + -> decltype(vis(0)) { using char_type = typename Context::char_type; switch (arg.type_) { case internal::none_type: @@ -926,8 +928,9 @@ FMT_CONSTEXPR auto visit_format_arg( } template -FMT_DEPRECATED FMT_CONSTEXPR auto visit( - Visitor&& vis, const basic_format_arg& arg) -> decltype(vis(0)) { +FMT_DEPRECATED FMT_CONSTEXPR auto visit(Visitor&& vis, + const basic_format_arg& arg) + -> decltype(vis(0)) { return visit_format_arg(std::forward(vis), arg); } @@ -950,7 +953,7 @@ template class arg_map { void push_back(value val) { const auto& named = *val.named_arg; - map_[size_] = entry{named.name, named.template deserialize()}; + map_[size_] = {named.name, named.template deserialize()}; ++size_; } @@ -980,12 +983,11 @@ class locale_ref { template Locale get() const; }; -template struct get_type { - static const type value = type_constant< - decltype(arg_mapper().map( - std::declval::type>())), - typename Context::char_type>::value; -}; +template +using get_type = + type_constant().map( + std::declval::type>())), + typename Context::char_type>; template constexpr unsigned long long get_types() { return 0;