@@ -119,6 +119,13 @@ using half_t = typename half_type<type_t>::type;
119119// standalone routines
120120// //////////////////////////////////////////////////////////////////////////////////////////////////
121121
122+ // make array from specified array
123+
124+ template <typename type_t , uint_t size, typename func_t >
125+ constexpr std::array<type_t , size> make_array (const std::array<type_t , size>& arr, const func_t & func);
126+ template <typename type_t , uint_t size, typename func_t , uint_t ... idx>
127+ constexpr std::array<type_t , size> make_array (const std::array<type_t , size>& arr, const func_t & func, std::integer_sequence<uint_t , idx...>);
128+
122129// extract low half of unsigned integer
123130
124131template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int > = 0 >
@@ -183,6 +190,24 @@ constexpr type_t divr2(type_t value1_hi, type_t value1_lo, type_t value2, std::o
183190// standalone routines
184191// //////////////////////////////////////////////////////////////////////////////////////////////////
185192
193+ template <typename type_t , uint_t size, typename func_t >
194+ constexpr std::array<type_t , size> make_array (const std::array<type_t , size>& arr, const func_t & func)
195+ {
196+ return make_array (arr, func, std::make_integer_sequence<uint_t , size>{});
197+ }
198+
199+
200+
201+ // //////////////////////////////////////////////////////////////////////////////////////////////////
202+ template <typename type_t , uint_t size, typename func_t , uint_t ... idx>
203+ constexpr std::array<type_t , size> make_array (const std::array<type_t , size>& arr, const func_t & func, std::integer_sequence<uint_t , idx...>)
204+ {
205+ return std::array<type_t , size>{ (func (idx, arr[idx]))... };
206+ }
207+
208+
209+
210+ // //////////////////////////////////////////////////////////////////////////////////////////////////
186211template <typename type_t , std::enable_if_t <is_unsigned_v<type_t >, int >>
187212constexpr type_t half_lo (type_t value) noexcept
188213{
0 commit comments