Example
#include <vector>
#include <cassert>
template <typename Cont, typename... Rest>
void f(Cont& c, Rest&... rest)
{
assert(c.size() == ???);
}
int main()
{
std::vector<int> v1(10);
std::vector<int> v2(10);
std::vector<int> v3(10);
std::vector<int> v4(10);
f(v1, v2, v3, v4);
}
I want to make sure that all the containers passed to a function are the same size. However, the function is a variadic template that takes an arbitrary number of containers of the same type. Is this possible?
1 Answer