Created
November 24, 2013 17:04
-
-
Save caetanus/7629496 to your computer and use it in GitHub Desktop.
initializer_list study c++11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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