fork download
  1. #include <iostream>
  2. #include <utility>
  3. using namespace std;
  4.  
  5. template<typename... Args>
  6. void any_other_f(Args... args)
  7. {
  8. double list[] = {args...};
  9. for (auto&& x : list)
  10. cout << x << ", ";
  11. cout << "\n";
  12. }
  13.  
  14. template<typename T, size_t... I>
  15. void wrapper_function(T&& t, index_sequence<I...>)
  16. {
  17. any_other_f(t[I]...);
  18. }
  19.  
  20. template<typename...Args>
  21. void f(Args...args)
  22. {
  23. constexpr size_t size = sizeof...(args);
  24. double list[] = {args...};
  25. for (int i = 0; i < size; ++i)
  26. list[i] *= -1;
  27. wrapper_function(list, make_index_sequence<4>());
  28. }
  29.  
  30. int main() {
  31. f(1.0, 2.0, 3.0);
  32. return 0;
  33. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
-1, -2, -3, -3.39999e-41,