]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/algorithms/detail/convert_point_to_point.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / convert_point_to_point.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9
10// Use, modification and distribution is subject to the Boost Software License,
11// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12// http://www.boost.org/LICENSE_1_0.txt)
13
14#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP
15#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP
16
17// Note: extracted from "convert.hpp" to avoid circular references convert/append
18
19#include <cstddef>
20
21#include <boost/numeric/conversion/cast.hpp>
22#include <boost/geometry/core/access.hpp>
23#include <boost/geometry/core/coordinate_dimension.hpp>
24#include <boost/geometry/core/coordinate_type.hpp>
25
26
27namespace boost { namespace geometry
28{
29
30#ifndef DOXYGEN_NO_DETAIL
31namespace detail { namespace conversion
32{
33
34
35template <typename Source, typename Destination, std::size_t Dimension, std::size_t DimensionCount>
36struct point_to_point
37{
38 static inline void apply(Source const& source, Destination& destination)
39 {
40 typedef typename coordinate_type<Destination>::type coordinate_type;
41
42 set<Dimension>(destination, boost::numeric_cast<coordinate_type>(get<Dimension>(source)));
43 point_to_point<Source, Destination, Dimension + 1, DimensionCount>::apply(source, destination);
44 }
45};
46
47template <typename Source, typename Destination, std::size_t DimensionCount>
48struct point_to_point<Source, Destination, DimensionCount, DimensionCount>
49{
50 static inline void apply(Source const& , Destination& )
51 {}
52};
53
54
55template <typename Source, typename Destination>
56inline void convert_point_to_point(Source const& source, Destination& destination)
57{
58 point_to_point<Source, Destination, 0, dimension<Destination>::value>::apply(source, destination);
59}
60
61
62
63}} // namespace detail::conversion
64#endif // DOXYGEN_NO_DETAIL
65
66}} // namespace boost::geometry
67
68#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_CONVERT_POINT_TO_POINT_HPP