Friday, 13 September 2013

My first variadic template


//main.cpp

#include <iostream>

void print()
{
  std::cout << '\n';
}


template<typename H, typename... T>

void print(H h, T... t)
{
  std::cout << h << ' ';
  print(t...);
}



int main()
{
  print(1);
  print(1, "h");
}


To build: g++ -std=c++0x main.cpp -o noodle