fork download
  1. #include <iostream>
  2. void PrintInternal() {
  3. std::cout << std::endl;
  4. }
  5.  
  6. template <typename...ARGS>
  7. void PrintInternal(const double& head, const ARGS&...rest);
  8.  
  9. template <typename T, typename...ARGS>
  10. void PrintInternal(const T& head, const ARGS&...rest) {
  11. std::cout << head << " ";
  12. PrintInternal(rest...);
  13. }
  14.  
  15. template <typename...ARGS>
  16. void PrintInternal(const double& head, const ARGS&...rest) {
  17. std::cout << "DBL!!! " << head << " ";
  18. PrintInternal(rest...);
  19. }
  20.  
  21. template <typename...ARGS>
  22. void Print(const ARGS&...args) {
  23. PrintInternal(args...);
  24. }
  25.  
  26. int main() {
  27. Print(1.1, 2, 3.3, 4);
  28. Print(0, 1.1, 2, 3.3, 4);
  29. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
DBL!!! 1.1 2 DBL!!! 3.3 4 
0 DBL!!! 1.1 2 DBL!!! 3.3 4