39 typedef std::list<long, std::allocator<long> > List;
40 typedef std::ostream_iterator<List::value_type,
41 char, std::char_traits<char> > os_iter;
44 const List::value_type arr [] = { 3, 4, 5, 6, 7, 8 };
45 List l (arr + 0, arr +
sizeof arr /
sizeof *arr);
48 List::iterator itr = l.begin ();
51 std::cout <<
"For the list: ";
52 std::copy (l.begin (), l.end (), os_iter (std::cout,
" "));
54 std::cout << std::endl << std::endl
55 <<
"When the iterator is initialized to l.begin (),"
56 <<
"\nit points to " << *itr << std::endl;
59 std::advance (itr, 4);
60 std::cout <<
"\nAfter advance (itr, 4), the iterator points to "