base.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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/iterator_adaptor.hpp>
  13. #include <boost/iterator/iterator_categories.hpp>
  14. #include <boost/mpl/if.hpp>
  15. #ifndef DOXYGEN_NO_DETAIL
  16. namespace boost { namespace geometry { namespace detail { namespace iterators
  17. {
  18. template
  19. <
  20. typename DerivedClass,
  21. typename Iterator,
  22. typename TraversalFlag = boost::bidirectional_traversal_tag
  23. >
  24. struct iterator_base
  25. : public boost::iterator_adaptor
  26. <
  27. DerivedClass,
  28. Iterator,
  29. boost::use_default,
  30. typename boost::mpl::if_
  31. <
  32. boost::is_convertible
  33. <
  34. typename boost::iterator_traversal<Iterator>::type,
  35. boost::random_access_traversal_tag
  36. >,
  37. TraversalFlag,
  38. boost::use_default
  39. >::type
  40. >
  41. {
  42. // Define operator cast to Iterator to be able to write things like Iterator it = myit++
  43. inline operator Iterator() const
  44. {
  45. return this->base();
  46. }
  47. /*inline bool operator==(Iterator const& other) const
  48. {
  49. return this->base() == other;
  50. }
  51. inline bool operator!=(Iterator const& other) const
  52. {
  53. return ! operator==(other);
  54. }*/
  55. };
  56. }}}} // namespace boost::geometry::detail::iterators
  57. #endif
  58. #endif // BOOST_GEOMETRY_ITERATORS_BASE_HPP