From def562c56ad8b4d5d2472b2b0621918c5422127f Mon Sep 17 00:00:00 2001 From: vsol Date: Sat, 14 Mar 2020 19:10:28 +0300 Subject: [PATCH] minor fixes --- include/fmt/core.h | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 993a9e96..ac4d8292 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1638,14 +1638,13 @@ template struct is_string_view, Char> : std::true_type {}; #ifdef FMT_USE_STRING_VIEW -template -struct is_string_view, Char> - : std::true_type {}; +template +struct is_string_view, Char> : std::true_type {}; #endif #ifdef FMT_USE_EXPERIMENTAL_STRING_VIEW -template -struct is_string_view, Char> +template +struct is_string_view, Char> : std::true_type {}; #endif @@ -1655,25 +1654,22 @@ template struct is_ref_wrapper> : std::true_type {}; template struct need_dyn_copy { - using mapped_type = mapped_type_constant; - static_assert(mapped_type::value != internal::type::named_arg_type, + static constexpr auto mapped_type = mapped_type_constant::value; + static_assert(mapped_type != internal::type::named_arg_type, "Bug indicator. Named arguments must be processed separately"); using type = std::integral_constant< bool, !(is_ref_wrapper::value || is_string_view::value || - (mapped_type::value != internal::type::cstring_type && - mapped_type::value != internal::type::custom_type && - mapped_type::value != internal::type::string_type))>; + (mapped_type != internal::type::cstring_type && + mapped_type != internal::type::custom_type && + mapped_type != internal::type::string_type))>; }; -template -using need_dyn_copy_t = typename need_dyn_copy::type; - class dyn_arg_storage { // Workaround clang's -Wweak-vtables. For templates (unlike regular classes // doesn't complain about inability to deduce translation unit to place vtable - // So dyn_arg_node_base is made a fake template + // So storage_node_base is made a fake template. template struct storage_node_base { using owning_ptr = std::unique_ptr>; @@ -1730,16 +1726,14 @@ class dynamic_format_arg_store { private: using char_type = typename Context::char_type; - using string_type = std::basic_string; - using value_type = basic_format_arg; template - using stored_type = - conditional_t::value, string_type, T>; + using stored_type = conditional_t::value, + std::basic_string, T>; // Storage of basic_format_arg must be contiguous - // Required by basic_format_args::args_ which is just a pointer - std::vector data_; + // Required by basic_format_args::args_ which is just a pointer. + std::vector> data_; // Storage of arguments not fitting into basic_format_arg must grow // without relocation because items in data_ refer to it. @@ -1802,7 +1796,8 @@ class dynamic_format_arg_store static_assert( !std::is_base_of, T>::value, "Named arguments are not supported yet"); - emplace_arg(stored_value(arg, internal::need_dyn_copy_t{})); + emplace_arg(stored_value( + arg, typename internal::need_dyn_copy::type{})); } /**