My intent is to create a function argument list of size n so I can pass it to a helper that uses a fold expression to recursively multiply the values together.
I'm a little stuck on how to make the argument list to pass to the helper. Is there a way to create a function argument list without a pack expression? Perhaps by creating an array or tuple?
Here's what I've come up with so far.
template<typename T, typename N>
T SmoothStart(const T& t, const N& n) {
static_assert(std::is_integral_v<N>, "templatized SmoothStart requires type of N to be integral.");
static_assert(n >= 0, "templatized SmoothStart requires value of N to be non-negative.");
if constexpr (n == 0) {
return 1;
}
if constexpr (n == 1) {
return t;
}
return SmoothStart_helper((t, ...)); //<-- obviously this doesn't work but it would be awesome to have!
}
template<typename T, typename... Args>
T SmoothStart_helper(Args&&... args) {
return (args * ...);
}