pointer_as_iterator.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Boost.Range library
  2. //
  3. // Copyright Neil Groves 2010. Use, modification and
  4. // distribution is subject to the Boost Software License, Version
  5. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. //
  9. // For more information, see http://www.boost.org/libs/range/
  10. //
  11. #include <boost/range/iterator_range.hpp>
  12. #include <boost/range/begin.hpp>
  13. #include <boost/range/end.hpp>
  14. #include <boost/array.hpp>
  15. #include <boost/test/test_tools.hpp>
  16. #include <boost/test/unit_test.hpp>
  17. #include <iostream>
  18. #include <vector>
  19. namespace
  20. {
  21. void test_pointer_as_iterator()
  22. {
  23. boost::array<int,3> arr;
  24. boost::iterator_range<const int*> r(arr.begin(), arr.end());
  25. r[0];
  26. }
  27. } // anonymous namespace
  28. boost::unit_test::test_suite*
  29. init_unit_test_suite(int argc, char* argv[])
  30. {
  31. boost::unit_test::test_suite* test
  32. = BOOST_TEST_SUITE( "RangeTestSuite.pointer_as_iterator" );
  33. test->add(BOOST_TEST_CASE( &test_pointer_as_iterator ));
  34. return test;
  35. }