#include #include #include #include #include #include #include #include #include #ifdef __cplusplus #include #include #include #include #include #include #include #endif #define COINFLIP() (rand() % 2) template double foo(std::tuple args1, std::tuple args2) { return std::get<0>(args1) + std::get<0>(args2); } template size_t bar(Args... args) { const auto v = {args...}; return v.size(); } template size_t baz(T x, Args... args) { const auto v = {args...}; return x + v.size(); } int main(int argc, char const *argv[]) { std::cout << "foo: " << foo(std::make_tuple(0.1 + COINFLIP(), 0.2 + COINFLIP(), 0.3 + COINFLIP()), std::make_tuple(COINFLIP(), COINFLIP(), COINFLIP())) << std::endl; std::cout << "bar: " << bar(COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP()) << std::endl; std::cout << "baz: " << baz(COINFLIP(), COINFLIP(), COINFLIP(), COINFLIP()) << std::endl; return 0; }