1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP
- #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP
- #include <cstddef>
- #include <boost/geometry/core/access.hpp>
- #include <boost/geometry/core/coordinate_dimension.hpp>
- #include <boost/geometry/core/coordinate_type.hpp>
- #include <boost/geometry/util/numeric_cast.hpp>
- namespace boost { namespace geometry
- {
- #ifndef DOXYGEN_NO_DETAIL
- namespace detail { namespace conversion
- {
- template <typename Source, typename Destination, std::size_t Dimension, std::size_t DimensionCount>
- struct point_to_point
- {
- static inline void apply(Source const& source, Destination& destination)
- {
- typedef typename coordinate_type<Destination>::type coordinate_type;
- set<Dimension>(destination, util::numeric_cast<coordinate_type>(get<Dimension>(source)));
- point_to_point<Source, Destination, Dimension + 1, DimensionCount>::apply(source, destination);
- }
- };
- template <typename Source, typename Destination, std::size_t DimensionCount>
- struct point_to_point<Source, Destination, DimensionCount, DimensionCount>
- {
- static inline void apply(Source const& , Destination& )
- {}
- };
- template <typename Source, typename Destination>
- inline void convert_point_to_point(Source const& source, Destination& destination)
- {
- point_to_point<Source, Destination, 0, dimension<Destination>::value>::apply(source, destination);
- }
- }}
- #endif
- }}
- #endif
|