I want to fill an std::array of size N with objects without a standard constructor.
std::array<non_std_con,N> myArray;
(It's std::array<kissfft<float>, 64>
in my case, to be specific)
This results in the error
error: use of deleted function ... standard constructor
Setup
You can fill the array using an intializer list:
std::array<non_std_con,N> myArray{non_std_con{init1,init2},non_std_con{init1,init2},...}
The initializer list needs N objects.
And you can build an array using parameter packs:
template <class... Params>
auto constexpr build_array(Params... params)
{
std::array<non_std_con, sizeof...(params)> myArray= {params...};
return myArray;
}
Question
Is there a way to use this the other way around and build a parameter pack out of a single argument:
std::array<non_std_con,N> buildArray(inti1,init2);
This would build an array of N non_std_con where every object is initialized with {init1,init2}
Thank you for your time