summaryrefslogtreecommitdiffstats
path: root/src/libutil/cxx
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-06-11 12:24:23 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-06-11 12:24:23 +0100
commit48297adf9639ed9711c55560a26a09bee3da9dd7 (patch)
tree8ce050732b0c8569c4e919eef7cc30a758d3e0bb /src/libutil/cxx
parent7116d3b8fe6605817d3fd9760562883d1976fa4c (diff)
downloadrspamd-48297adf9639ed9711c55560a26a09bee3da9dd7.tar.gz
rspamd-48297adf9639ed9711c55560a26a09bee3da9dd7.zip
[Minor] Simplify array_of using types deduction
Diffstat (limited to 'src/libutil/cxx')
-rw-r--r--src/libutil/cxx/util.hxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libutil/cxx/util.hxx b/src/libutil/cxx/util.hxx
index e45f16008..5b2020bb6 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 <typename V, typename... T>
-constexpr auto array_of(T&&... t) -> std::array<V, sizeof...(T)>
+template <typename... Ts>
+constexpr auto array_of(Ts&&... t) -> std::array<typename std::decay_t<typename std::common_type_t<Ts...>>, sizeof...(Ts)>
{
+ using T = typename std::decay_t<typename std::common_type_t<Ts...>>;
return {{ std::forward<T>(t)... }};
}