base.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. // This file was modified by Oracle on 2020.
  6. // Modifications copyright (c) 2020 Oracle and/or its affiliates.
  7. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  8. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  9. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  10. // Use, modification and distribution is subject to the Boost Software License,
  11. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. #ifndef BOOST_GEOMETRY_ITERATORS_BASE_HPP
  14. #define BOOST_GEOMETRY_ITERATORS_BASE_HPP
  15. #include <type_traits>
  16. #include <boost/iterator/iterator_adaptor.hpp>
  17. #include <boost/iterator/iterator_categories.hpp>
  18. #ifndef DOXYGEN_NO_DETAIL
  19. namespace boost { namespace geometry { namespace detail { namespace iterators
  20. {
  21. template
  22. <
  23. typename DerivedClass,
  24. typename Iterator,
  25. typename TraversalFlag = boost::bidirectional_traversal_tag
  26. >
  27. struct iterator_base
  28. : public boost::iterator_adaptor
  29. <
  30. DerivedClass,
  31. Iterator,
  32. boost::use_default,
  33. std::conditional_t
  34. <
  35. std::is_convertible
  36. <
  37. typename boost::iterator_traversal<Iterator>::type,
  38. boost::random_access_traversal_tag
  39. >::value,
  40. TraversalFlag,
  41. boost::use_default
  42. >
  43. >
  44. {
  45. // Define operator cast to Iterator to be able to write things like Iterator it = myit++
  46. inline operator Iterator() const
  47. {
  48. return this->base();
  49. }
  50. /*inline bool operator==(Iterator const& other) const
  51. {
  52. return this->base() == other;
  53. }
  54. inline bool operator!=(Iterator const& other) const
  55. {
  56. return ! operator==(other);
  57. }*/
  58. };
  59. }}}} // namespace boost::geometry::detail::iterators
  60. #endif
  61. #endif // BOOST_GEOMETRY_ITERATORS_BASE_HPP