Created
May 22, 2018 08:26
-
-
Save cengiz-io/9399d2bc5b543347c863e091c5c4c5a8 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 <iterator> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
template <typename T> | |
ostream& operator<< (ostream& out, const vector<T>& v) { | |
if (!v.empty()) { | |
copy(v.begin(), v.end(), ostream_iterator<T>(out, "|")); | |
} | |
return out; | |
} | |
int main() { | |
auto words = { "Hello", "World"}; | |
vector<string> result; | |
for (const string& word : words) { | |
result.push_back(word); | |
} | |
cout << result << endl; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment