I want to make a variadic template with exactly N arguments, where N is also a template parameter. For example,
template
void fu
You can use std::enable_if instead of static_assert:
template <std::size_t N, typename ...Args>
auto function(Args&&... args)
-> typename std::enable_if<N == sizeof...(Args), void>::type
{
...
}
Update: It's also possible to use it in constructors, where N is a template argument of the class.
template <std::size_t N>
struct foobar
{
template <typename ...Args, typename = typename std::enable_if<N == sizeof...(Args), void>::type>
foobar(Args&&... args) { ... }
};