I want to create a variation template with exactly N arguments, where N is also a template parameter. For instance,
template <int N, typename T[N]>
void function(T t[N]) {
}
(I understand that the above syntax is invalid)
I know that one way to achieve this is to use static_asserton sizeof...(ArgsT), where ArgsTis the definition of the variational pattern (i.e. template <typename ...ArgsT>).
I'm just wondering if there is a better way, not necessarily including static_assert.
source
share