Debian Codegraph @

yo/containers/examples/listmerge.cc

raw
1 #include <iostream>
2 #include <string>
3 #include <list>
4 using namespace std;
5
6 void showlist(list<string> &target)
7 {
8 for
9 (
10 list<string>::iterator from = target.begin();
11 from != target.end();
12 ++from
13 )
14 cout << *from << " ";
15
16 cout << '\n';
17 }
18
19 int main()
20 {
21 list<string> first;
22 list<string> second;
23
24 first.push_back("alpha"s);
25 first.push_back("bravo"s);
26 first.push_back("golf"s);
27 first.push_back("quebec"s);
28
29 second.push_back("oscar"s);
30 second.push_back("mike"s);
31 second.push_back("november"s);
32 second.push_back("zulu"s);
33
34 first.merge(second);
35 showlist(first);
36 }
37 // shows:
38 // alpha bravo golf oscar mike november quebec zulu