From: Vsevolod Stakhov Date: Sat, 11 Jun 2022 11:24:23 +0000 (+0100) Subject: [Minor] Simplify array_of using types deduction X-Git-Tag: 3.3~197 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=48297adf9639ed9711c55560a26a09bee3da9dd7;p=thirdparty%2Frspamd.git [Minor] Simplify array_of using types deduction --- diff --git a/src/client/rspamc.cxx b/src/client/rspamc.cxx index 2a2332bca4..b7341be4f0 100644 --- a/src/client/rspamc.cxx +++ b/src/client/rspamc.cxx @@ -214,7 +214,7 @@ struct rspamc_command { void (*command_output_func)(FILE *, ucl_object_t *obj); }; -static const constexpr auto rspamc_commands = rspamd::array_of( +static const constexpr auto rspamc_commands = rspamd::array_of( rspamc_command{ .cmd = RSPAMC_COMMAND_SYMBOLS, .name = "symbols", diff --git a/src/libserver/html/html_tag_defs.hxx b/src/libserver/html/html_tag_defs.hxx index 7e6cc9bf6f..812ec20218 100644 --- a/src/libserver/html/html_tag_defs.hxx +++ b/src/libserver/html/html_tag_defs.hxx @@ -33,7 +33,7 @@ struct html_tag_def { #define TAG_DEF(id, name, flags) html_tag_def{(name), (id), (flags)} -static const auto html_tag_defs_array = rspamd::array_of( +static const auto html_tag_defs_array = rspamd::array_of( /* W3C defined elements */ TAG_DEF(Tag_A, "a", FL_HREF), TAG_DEF(Tag_ABBR, "abbr", (CM_INLINE)), diff --git a/src/libutil/cxx/util.hxx b/src/libutil/cxx/util.hxx index e45f16008a..5b2020bb66 100644 --- a/src/libutil/cxx/util.hxx +++ b/src/libutil/cxx/util.hxx @@ -72,9 +72,10 @@ struct smart_ptr_hash { /* * Creates std::array from a standard C style array with automatic size calculation */ -template -constexpr auto array_of(T&&... t) -> std::array +template +constexpr auto array_of(Ts&&... t) -> std::array>, sizeof...(Ts)> { + using T = typename std::decay_t>; return {{ std::forward(t)... }}; }