Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
Add Comment
Please, Sign In to add comment