reverse_iterator.cpp 558 B

12345678910111213141516171819
  1. // Copyright (C) 2004 Jeremy Siek <jsiek@cs.indiana.edu>
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/iterator/reverse_iterator.hpp>
  6. #include <boost/cstdlib.hpp>
  7. #include <iostream>
  8. #include <iterator>
  9. #include <algorithm>
  10. int main()
  11. {
  12. int x[] = { 1, 2, 3, 4 };
  13. boost::reverse_iterator<int*> first(x + 4), last(x);
  14. std::copy(first, last, std::ostream_iterator<int>(std::cout, " "));
  15. std::cout << std::endl;
  16. return 0;
  17. }