How to check that all types in variadic template are convertible to size_t?
问题 How can I check that all types in a variadic template declaration can be converted to size_t: // instantiate only if extents params are all convertible to size_t template<typename T, size_t N> template<typename... E> Array<T,N>::Array(E... extents) { constexpr size_t n = sizeof...(extents); static_assert(n == N, "Dimensions do not match"); // code for handling variadic template parameters corresponding to dimension sizes } With the following usage: Array<double, 2> a(5,6); // OK 2-D array of