Mercurial > thymian
comparison 3rdparty/vmime/cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-variadic_templates.cpp @ 0:a4671277546c tip
created the repository for the thymian project
| author | ferencd |
|---|---|
| date | Tue, 17 Aug 2021 11:19:54 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:a4671277546c |
|---|---|
| 1 int Accumulate() | |
| 2 { | |
| 3 return 0; | |
| 4 } | |
| 5 | |
| 6 template<typename T, typename... Ts> | |
| 7 int Accumulate(T v, Ts... vs) | |
| 8 { | |
| 9 return v + Accumulate(vs...); | |
| 10 } | |
| 11 | |
| 12 template<int... Is> | |
| 13 int CountElements() | |
| 14 { | |
| 15 return sizeof...(Is); | |
| 16 } | |
| 17 | |
| 18 int main() | |
| 19 { | |
| 20 int acc = Accumulate(1, 2, 3, 4, -5); | |
| 21 int count = CountElements<1,2,3,4,5>(); | |
| 22 return ((acc == 5) && (count == 5)) ? 0 : 1; | |
| 23 } |
