aboutsummaryrefslogtreecommitdiffstats
path: root/lib/entityx/cxx11/c++11-test-variadic_templates-N2555.cpp
blob: 4518e886fd188a51fa8e8c2eef3216566f8481f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
int Accumulate()
{
	return 0;
}

template<typename T, typename... Ts>
int Accumulate(T v, Ts... vs)
{
	return v + Accumulate(vs...);
}

template<int... Is>
int CountElements()
{
	return sizeof...(Is);
}

int main()
{
	int acc = Accumulate(1, 2, 3, 4, -5);
	int count = CountElements<1,2,3,4,5>();
	return ((acc == 5) && (count == 5)) ? 0 : 1;
}