Skip to content

Instantly share code, notes, and snippets.

@cengiz-io
Created May 22, 2018 08:26
Show Gist options
  • Save cengiz-io/9399d2bc5b543347c863e091c5c4c5a8 to your computer and use it in GitHub Desktop.
Save cengiz-io/9399d2bc5b543347c863e091c5c4c5a8 to your computer and use it in GitHub Desktop.
#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