File indexing completed on 2025-12-16 09:51:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GEOMETRY_VIEWS_GEOMETRY_COLLECTION_VIEW_HPP
0011 #define BOOST_GEOMETRY_VIEWS_GEOMETRY_COLLECTION_VIEW_HPP
0012
0013 #include <boost/core/addressof.hpp>
0014
0015 #include <boost/geometry/core/geometry_types.hpp>
0016 #include <boost/geometry/core/tag.hpp>
0017 #include <boost/geometry/core/tags.hpp>
0018 #include <boost/geometry/core/visit.hpp>
0019 #include <boost/geometry/util/sequence.hpp>
0020
0021 namespace boost { namespace geometry
0022 {
0023
0024 namespace detail
0025 {
0026
0027
0028 template <typename Geometry>
0029 class geometry_collection_view
0030 {
0031 public:
0032 using iterator = Geometry const*;
0033 using const_iterator = Geometry const*;
0034
0035 explicit geometry_collection_view(Geometry const& geometry)
0036 : m_geometry(geometry)
0037 {}
0038
0039 const_iterator begin() const { return boost::addressof(m_geometry); }
0040 const_iterator end() const { return boost::addressof(m_geometry) + 1; }
0041
0042 private:
0043 Geometry const& m_geometry;
0044 };
0045
0046 }
0047
0048
0049 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0050 namespace traits
0051 {
0052
0053 template <typename Geometry>
0054 struct tag<geometry::detail::geometry_collection_view<Geometry>>
0055 {
0056 using type = geometry_collection_tag;
0057 };
0058
0059
0060 template <typename Geometry>
0061 struct geometry_types<geometry::detail::geometry_collection_view<Geometry>>
0062 {
0063 using type = util::type_sequence<Geometry>;
0064 };
0065
0066
0067 template <typename Geometry>
0068 struct iter_visit<geometry::detail::geometry_collection_view<Geometry>>
0069 {
0070 template <typename Function, typename Iterator>
0071 static void apply(Function && function, Iterator iterator)
0072 {
0073 function(*iterator);
0074 }
0075 };
0076
0077
0078 }
0079 #endif
0080
0081
0082 }}
0083
0084 #endif