Skip to content

Instantly share code, notes, and snippets.

@caetanus
Created November 24, 2013 17:04
Show Gist options
  • Select an option

  • Save caetanus/7629496 to your computer and use it in GitHub Desktop.

Select an option

Save caetanus/7629496 to your computer and use it in GitHub Desktop.
initializer_list study c++11
#include <iostream>
#include <initializer_list>
using namespace std;
template <class T>
void printItOut(initializer_list<T> args)
{
for(auto v: args)
{
cout << v << ' ';
}
cout << '\n';
}
int main()
{
printItOut<double>({1,2,3, 99, 3,4.4, 55});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment