// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_PAIR_AS_SEGMENT_HPP #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_PAIR_AS_SEGMENT_HPP // Only possible if the std::pair is not used for iterator/pair // (maybe it is possible to avoid that by detecting in the other file // if an iterator was used in the pair) #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 #include #include #include namespace boost { namespace geometry { #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS namespace traits { template struct tag > { typedef segment_tag type; }; template struct point_type > { typedef Point type; }; template struct indexed_access, 0, Dimension> { typedef typename geometry::coordinate_type::type coordinate_type; static inline coordinate_type get(std::pair const& s) { return geometry::get(s.first); } static inline void set(std::pair& s, coordinate_type const& value) { geometry::set(s.first, value); } }; template struct indexed_access, 1, Dimension> { typedef typename geometry::coordinate_type::type coordinate_type; static inline coordinate_type get(std::pair const& s) { return geometry::get(s.second); } static inline void set(std::pair& s, coordinate_type const& value) { geometry::set(s.second, value); } }; } // namespace traits #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS }} // namespace boost::geometry #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_PAIR_AS_SEGMENT_HPP