base.hpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
  5. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  6. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_GEOMETRY_ITERATORS_BASE_HPP
  11. #define BOOST_GEOMETRY_ITERATORS_BASE_HPP
  12. #include <boost/iterator.hpp>
  13. #include <boost/iterator/iterator_adaptor.hpp>
  14. #include <boost/iterator/iterator_categories.hpp>
  15. #include <boost/mpl/if.hpp>
  16. #ifndef DOXYGEN_NO_DETAIL
  17. namespace boost { namespace geometry { namespace detail { namespace iterators
  18. {
  19. template
  20. <
  21. typename DerivedClass,
  22. typename Iterator,
  23. typename TraversalFlag = boost::bidirectional_traversal_tag
  24. >
  25. struct iterator_base
  26. : public boost::iterator_adaptor
  27. <
  28. DerivedClass,
  29. Iterator,
  30. boost::use_default,
  31. typename boost::mpl::if_
  32. <
  33. boost::is_convertible
  34. <
  35. typename boost::iterator_traversal<Iterator>::type,
  36. boost::random_access_traversal_tag
  37. >,
  38. TraversalFlag,
  39. boost::use_default
  40. >::type
  41. >
  42. {
  43. // Define operator cast to Iterator to be able to write things like Iterator it = myit++
  44. inline operator Iterator() const
  45. {
  46. return this->base();
  47. }
  48. /*inline bool operator==(Iterator const& other) const
  49. {
  50. return this->base() == other;
  51. }
  52. inline bool operator!=(Iterator const& other) const
  53. {
  54. return ! operator==(other);
  55. }*/
  56. };
  57. }}}} // namespace boost::geometry::detail::iterators
  58. #endif
  59. #endif // BOOST_GEOMETRY_ITERATORS_BASE_HPP