1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_PAIR_AS_SEGMENT_HPP
- #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_PAIR_AS_SEGMENT_HPP
- #ifdef BOOST_GEOMETRY_ADAPTED_STD_RANGE_TAG_DEFINED
- #error Include only one headerfile to register tag for adapted std:: containers or iterator pair
- #endif
- #define BOOST_GEOMETRY_ADAPTED_STD_RANGE_TAG_DEFINED
- #include <cstddef>
- #include <boost/geometry/core/access.hpp>
- #include <boost/geometry/core/tag.hpp>
- #include <boost/geometry/core/tags.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
- namespace traits
- {
- template <typename Point>
- struct tag<std::pair<Point, Point> >
- {
- typedef segment_tag type;
- };
- template <typename Point>
- struct point_type<std::pair<Point, Point> >
- {
- typedef Point type;
- };
- template <typename Point, std::size_t Dimension>
- struct indexed_access<std::pair<Point, Point>, 0, Dimension>
- {
- typedef typename geometry::coordinate_type<Point>::type coordinate_type;
- static inline coordinate_type get(std::pair<Point, Point> const& s)
- {
- return geometry::get<Dimension>(s.first);
- }
- static inline void set(std::pair<Point, Point>& s, coordinate_type const& value)
- {
- geometry::set<Dimension>(s.first, value);
- }
- };
- template <typename Point, std::size_t Dimension>
- struct indexed_access<std::pair<Point, Point>, 1, Dimension>
- {
- typedef typename geometry::coordinate_type<Point>::type coordinate_type;
- static inline coordinate_type get(std::pair<Point, Point> const& s)
- {
- return geometry::get<Dimension>(s.second);
- }
- static inline void set(std::pair<Point, Point>& s, coordinate_type const& value)
- {
- geometry::set<Dimension>(s.second, value);
- }
- };
- }
- #endif
- }}
- #endif
|