40 typedef std::vector<int, std::allocator<int> >
Vector;
42 typedef std::ostream_iterator<Vector::value_type,
44 std::char_traits<char> > os_iter;
47 const Vector::value_type arr [] = { 3, 4, 5, 6, 7, 8 };
48 const Vector v (arr + 0, arr +
sizeof arr/
sizeof *arr);
51 Vector::const_iterator it =
v.begin () + 3;
54 std::cout <<
"For the vector: ";
55 std::copy (
v.begin (),
v.end (), os_iter (std::cout,
" "));
58 std::cout <<
"\nWhen the iterator is initialized to point to "
62 Vector::difference_type
dist = 0;
64#ifndef _RWSTD_NO_EXT_VOID_DISTANCE
69 std::distance (
v.begin (), it,
dist);
76 dist = std::distance (
v.begin (), it);
78 std::cout <<
"The distance between the beginning and "
79 << *it <<
" is " <<
dist <<
'\n';
std::vector< UserClass, std::allocator< UserClass > > Vector