cmake/c++11-test-variadic_templates-N2555.cpp

changeset 473
2a84149fe642
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cmake/c++11-test-variadic_templates-N2555.cpp	Thu Aug 22 20:24:16 2013 +0300
@@ -0,0 +1,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;
+}

mercurial