fork download
  1. #include <iostream>
  2.  
  3. inline void zeroVars() {}
  4.  
  5. template<class Arg, class... Args>
  6. inline void zeroVars(Arg& arg, Args&... args)
  7. {
  8. arg = 0;
  9. zeroVars(args...);
  10. }
  11.  
  12. int main(int argc, char** argv) {
  13. int i = 1;
  14. double j = 1;
  15. std::cout << i << ", " << j << '\n';
  16. zeroVars(i, j);
  17. std::cout << i << ", " << j << '\n';
  18. }
Success #stdin #stdout 0s 3140KB
stdin
Standard input is empty
stdout
1, 1
0, 0