boost_no_std_iterator.ipp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // (C) Copyright John Maddock 2001.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for the most recent version.
  6. // MACRO: BOOST_NO_STD_ITERATOR
  7. // TITLE: std::iterator
  8. // DESCRIPTION: The C++ implementation fails to provide the
  9. // std::iterator class.
  10. #include <iterator>
  11. #include <stddef.h>
  12. namespace boost_no_std_iterator{
  13. int test()
  14. {
  15. typedef std::iterator<
  16. std::random_access_iterator_tag,
  17. int,
  18. ptrdiff_t,
  19. int*,
  20. int&
  21. > iterator_type;
  22. iterator_type::value_type v = 0;
  23. iterator_type::difference_type d = 0;
  24. iterator_type::pointer p = &v;
  25. iterator_type::reference r = v;
  26. iterator_type::iterator_category cat;
  27. typedef std::iterator<
  28. std::random_access_iterator_tag,
  29. int
  30. > iterator_type_2;
  31. iterator_type_2::value_type v2 = 0;
  32. iterator_type_2::difference_type d2 = 0;
  33. iterator_type_2::pointer p2 = &v2;
  34. iterator_type_2::reference r2 = v2;
  35. iterator_type_2::iterator_category cat2;
  36. //
  37. // suppress some warnings:
  38. //
  39. (void) &v;
  40. (void) &d;
  41. (void) &p;
  42. (void) &r;
  43. (void) &cat;
  44. (void) &v2;
  45. (void) &d2;
  46. (void) &p2;
  47. (void) &r2;
  48. (void) &cat2;
  49. return 0;
  50. }
  51. }