Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:27

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0004 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 
0007 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0008 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_PAIR_AS_SEGMENT_HPP
0015 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_PAIR_AS_SEGMENT_HPP
0016 
0017 // Only possible if the std::pair is not used for iterator/pair
0018 // (maybe it is possible to avoid that by detecting in the other file
0019 //  if an iterator was used in the pair)
0020 
0021 #ifdef BOOST_GEOMETRY_ADAPTED_STD_RANGE_TAG_DEFINED
0022 #error Include only one headerfile to register tag for adapted std:: containers or iterator pair
0023 #endif
0024 
0025 #define BOOST_GEOMETRY_ADAPTED_STD_RANGE_TAG_DEFINED
0026 
0027 
0028 #include <cstddef>
0029 
0030 
0031 #include <boost/geometry/core/access.hpp>
0032 #include <boost/geometry/core/tag.hpp>
0033 #include <boost/geometry/core/tags.hpp>
0034 
0035 
0036 namespace boost { namespace geometry
0037 {
0038 
0039 
0040 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0041 namespace traits
0042 {
0043 
0044 
0045 template <typename Point>
0046 struct tag<std::pair<Point, Point> >
0047 {
0048     typedef segment_tag type;
0049 };
0050 
0051 template <typename Point>
0052 struct point_type<std::pair<Point, Point> >
0053 {
0054     typedef Point type;
0055 };
0056 
0057 template <typename Point, std::size_t Dimension>
0058 struct indexed_access<std::pair<Point, Point>, 0, Dimension>
0059 {
0060     typedef typename geometry::coordinate_type<Point>::type coordinate_type;
0061 
0062     static inline coordinate_type get(std::pair<Point, Point> const& s)
0063     {
0064         return geometry::get<Dimension>(s.first);
0065     }
0066 
0067     static inline void set(std::pair<Point, Point>& s, coordinate_type const& value)
0068     {
0069         geometry::set<Dimension>(s.first, value);
0070     }
0071 };
0072 
0073 
0074 template <typename Point, std::size_t Dimension>
0075 struct indexed_access<std::pair<Point, Point>, 1, Dimension>
0076 {
0077     typedef typename geometry::coordinate_type<Point>::type coordinate_type;
0078 
0079     static inline coordinate_type get(std::pair<Point, Point> const& s)
0080     {
0081         return geometry::get<Dimension>(s.second);
0082     }
0083 
0084     static inline void set(std::pair<Point, Point>& s, coordinate_type const& value)
0085     {
0086         geometry::set<Dimension>(s.second, value);
0087     }
0088 };
0089 
0090 
0091 } // namespace traits
0092 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0093 
0094 
0095 }} // namespace boost::geometry
0096 
0097 
0098 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_PAIR_AS_SEGMENT_HPP