From 04cde756bc4d0e4cbd294d343e0cfc5e5db6f86b Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 19 Apr 2020 07:35:19 -0700 Subject: [PATCH] Simplify checks --- include/fmt/core.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 6c07f04e..fa317cef 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1689,7 +1689,7 @@ struct named_arg : view, named_arg_base { template ::value)> inline void check_format_string(const S&) { -#if defined(FMT_ENFORCE_COMPILE_STRING) +#ifdef FMT_ENFORCE_COMPILE_STRING static_assert(is_compile_string::value, "FMT_ENFORCE_COMPILE_STRING requires all format strings to " "utilize FMT_STRING() or fmt()."); @@ -1698,19 +1698,13 @@ inline void check_format_string(const S&) { template ::value)> void check_format_string(S); -template struct bool_pack; -template -using all_true = - std::is_same, bool_pack>; - template > inline format_arg_store, remove_reference_t...> make_args_checked(const S& format_str, const remove_reference_t&... args) { - static_assert( - all_true<(!std::is_base_of>::value || - !std::is_reference::value)...>::value, - "passing views as lvalues is disallowed"); + static_assert(count<(std::is_base_of>::value && + std::is_reference::value)...>() == 0, + "passing views as lvalues is disallowed"); check_format_string(format_str); return {args...}; }