Debian Codegraph @

yo/containers/examples/listsplice.cc

raw
1 #include <iostream>
2 #include <string>
3 #include <list>
4 using namespace std;
5
6 int main()
7 {
8 list<string> object;
9
10 object.push_front("Hello"s);
11 object.push_back("World"s);
12
13 list<string> argument(object);
14
15 object.splice(++object.begin(), argument);
16
17 cout << "Object contains " << object.size() << " elements, " <<
18 "Argument contains " << argument.size() <<
19 " elements,\n";
20
21 while (object.size())
22 {
23 cout << object.front() << '\n';
24 object.pop_front();
25 }
26 }