Guest User

Untitled

a guest
May 26th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <iterator>
  3. #include <algorithm>
  4.  
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. template <typename T>
  10. ostream& operator<< (ostream& out, const vector<T>& v) {
  11. if (!v.empty()) {
  12. copy(v.begin(), v.end(), ostream_iterator<T>(out, "|"));
  13. }
  14. return out;
  15. }
  16.  
  17. int main() {
  18. auto words = { "Hello", "World"};
  19.  
  20. vector<string> result;
  21.  
  22. for (const string& word : words) {
  23. result.push_back(word);
  24. }
  25.  
  26. cout << result << endl;
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment