I have a problem similar to
Generating a sequence of zeros at compile time
However, in my case I have no pack to expand. The situation is like this:
template<size_t N>
void foo()
{ bar(T{}, ..., static_cast<T>(1)); }
There are N - 1
T{}:s followed by a one.
It may happen that T
is not usable as a non-type template parameter. There are two differences compared to the linked post
- In the linked post, there is already a parameter pack to rely on
- In the linked post, it is assumed that all arguments are integers
I may use a solution that require C++20