// This program demonstrates the copy algorithm. // This is NOT a method! #include // for copy #include #include using namespace std; int main() { list s = {'n', 'e', 'h', 'e'}; s.push_front('o'); s.push_back('a'); s.push_front('b'); s.push_back('d'); s.push_front('X'); auto it = s.begin(); // type list::iterator char buf[80]; copy(++it, s.end(), buf); buf[8] = '\0'; // Unfortunate magic number “8”—what to do? cout << buf << '\n'; }