Commit afdbbac7 authored by Victor Zverovich's avatar Victor Zverovich

Cleanup

parent e33fe14f
...@@ -197,6 +197,8 @@ template <bool B, class T, class F> ...@@ -197,6 +197,8 @@ template <bool B, class T, class F>
using conditional_t = typename std::conditional<B, T, F>::type; using conditional_t = typename std::conditional<B, T, F>::type;
template <bool B> using bool_constant = std::integral_constant<bool, B>; template <bool B> using bool_constant = std::integral_constant<bool, B>;
struct monostate {};
// An enable_if helper to be used in template parameters which results in much // 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 // shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed
// to workaround a bug in MSVC 2019 (see #1140 and #1186). // to workaround a bug in MSVC 2019 (see #1140 and #1186).
...@@ -844,8 +846,9 @@ template <typename Context> class basic_format_arg { ...@@ -844,8 +846,9 @@ template <typename Context> class basic_format_arg {
const T& value); const T& value);
template <typename Visitor, typename Ctx> template <typename Visitor, typename Ctx>
friend FMT_CONSTEXPR auto visit_format_arg( friend FMT_CONSTEXPR auto visit_format_arg(Visitor&& vis,
Visitor&& vis, const basic_format_arg<Ctx>& arg) -> decltype(vis(0)); const basic_format_arg<Ctx>& arg)
-> decltype(vis(0));
friend class basic_format_args<Context>; friend class basic_format_args<Context>;
friend class internal::arg_map<Context>; friend class internal::arg_map<Context>;
...@@ -877,8 +880,6 @@ template <typename Context> class basic_format_arg { ...@@ -877,8 +880,6 @@ template <typename Context> class basic_format_arg {
bool is_arithmetic() const { return internal::is_arithmetic(type_); } bool is_arithmetic() const { return internal::is_arithmetic(type_); }
}; };
struct monostate {};
/** /**
\rst \rst
Visits an argument dispatching to the appropriate visit method based on Visits an argument dispatching to the appropriate visit method based on
...@@ -887,8 +888,9 @@ struct monostate {}; ...@@ -887,8 +888,9 @@ struct monostate {};
\endrst \endrst
*/ */
template <typename Visitor, typename Context> template <typename Visitor, typename Context>
FMT_CONSTEXPR auto visit_format_arg( FMT_CONSTEXPR auto visit_format_arg(Visitor&& vis,
Visitor&& vis, const basic_format_arg<Context>& arg) -> decltype(vis(0)) { const basic_format_arg<Context>& arg)
-> decltype(vis(0)) {
using char_type = typename Context::char_type; using char_type = typename Context::char_type;
switch (arg.type_) { switch (arg.type_) {
case internal::none_type: case internal::none_type:
...@@ -926,8 +928,9 @@ FMT_CONSTEXPR auto visit_format_arg( ...@@ -926,8 +928,9 @@ FMT_CONSTEXPR auto visit_format_arg(
} }
template <typename Visitor, typename Context> template <typename Visitor, typename Context>
FMT_DEPRECATED FMT_CONSTEXPR auto visit( FMT_DEPRECATED FMT_CONSTEXPR auto visit(Visitor&& vis,
Visitor&& vis, const basic_format_arg<Context>& arg) -> decltype(vis(0)) { const basic_format_arg<Context>& arg)
-> decltype(vis(0)) {
return visit_format_arg(std::forward<Visitor>(vis), arg); return visit_format_arg(std::forward<Visitor>(vis), arg);
} }
...@@ -950,7 +953,7 @@ template <typename Context> class arg_map { ...@@ -950,7 +953,7 @@ template <typename Context> class arg_map {
void push_back(value<Context> val) { void push_back(value<Context> val) {
const auto& named = *val.named_arg; const auto& named = *val.named_arg;
map_[size_] = entry{named.name, named.template deserialize<Context>()}; map_[size_] = {named.name, named.template deserialize<Context>()};
++size_; ++size_;
} }
...@@ -980,12 +983,11 @@ class locale_ref { ...@@ -980,12 +983,11 @@ class locale_ref {
template <typename Locale> Locale get() const; template <typename Locale> Locale get() const;
}; };
template <typename Context, typename T> struct get_type { template <typename Context, typename T>
static const type value = type_constant< using get_type =
decltype(arg_mapper<Context>().map( type_constant<decltype(arg_mapper<Context>().map(
std::declval<typename std::remove_volatile<T>::type>())), std::declval<typename std::remove_volatile<T>::type>())),
typename Context::char_type>::value; typename Context::char_type>;
};
template <typename Context> constexpr unsigned long long get_types() { template <typename Context> constexpr unsigned long long get_types() {
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment