Created
October 27, 2017 03:56
-
-
Save 0xch4z/9627be57124fead33e096a17a1f64bc4 to your computer and use it in GitHub Desktop.
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 <vector> | |
| template <class T> | |
| void log_vector(const std::vector<T> &vec) { | |
| std::cout << "[" << std::endl; | |
| for (const T el: vec) { | |
| std::cout << '\t' << el << ',' << std::endl; | |
| } | |
| std::cout << "]" << std::endl; | |
| } | |
| int main(const int argc, const char **argv) { | |
| std::vector<int> foo = { 1, 2, 3 }; | |
| log_vector(foo); | |
| /** | |
| * => | |
| * "[ | |
| * 1, | |
| * 2, | |
| * 3, | |
| * ]" | |
| */ | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment