File indexing completed on 2025-01-18 09:35:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP
0019 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_C_ARRAY_HPP
0020
0021 #include <cstddef>
0022 #include <type_traits>
0023
0024 #include <boost/geometry/core/access.hpp>
0025 #include <boost/geometry/core/cs.hpp>
0026 #include <boost/geometry/core/coordinate_dimension.hpp>
0027 #include <boost/geometry/core/coordinate_type.hpp>
0028 #include <boost/geometry/core/tags.hpp>
0029
0030 namespace boost { namespace geometry
0031 {
0032
0033
0034 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0035 namespace traits
0036 {
0037
0038
0039 #ifndef DOXYGEN_NO_DETAIL
0040 namespace detail
0041 {
0042
0043
0044
0045
0046 template <bool>
0047 struct c_array_tag
0048 {
0049 typedef geometry_not_recognized_tag type;
0050 };
0051
0052
0053 template <>
0054 struct c_array_tag<true>
0055 {
0056 typedef point_tag type;
0057 };
0058
0059
0060 }
0061 #endif
0062
0063
0064
0065 template <typename CoordinateType, std::size_t DimensionCount>
0066 struct tag<CoordinateType[DimensionCount]>
0067 : detail::c_array_tag<std::is_arithmetic<CoordinateType>::value> {};
0068
0069
0070 template <typename CoordinateType, std::size_t DimensionCount>
0071 struct coordinate_type<CoordinateType[DimensionCount]>
0072 {
0073 typedef CoordinateType type;
0074 };
0075
0076
0077 template <typename CoordinateType, std::size_t DimensionCount>
0078 struct dimension<CoordinateType[DimensionCount]>
0079 : std::integral_constant<std::size_t, DimensionCount>
0080 {};
0081
0082
0083 template <typename CoordinateType, std::size_t DimensionCount, std::size_t Dimension>
0084 struct access<CoordinateType[DimensionCount], Dimension>
0085 {
0086 static inline CoordinateType get(CoordinateType const p[DimensionCount])
0087 {
0088 return p[Dimension];
0089 }
0090
0091 static inline void set(CoordinateType p[DimensionCount],
0092 CoordinateType const& value)
0093 {
0094 p[Dimension] = value;
0095 }
0096 };
0097
0098
0099 }
0100 #endif
0101
0102
0103 }}
0104
0105
0106 #define BOOST_GEOMETRY_REGISTER_C_ARRAY_CS(CoordinateSystem) \
0107 namespace boost { namespace geometry { namespace traits { \
0108 template <typename T, std::size_t N> \
0109 struct coordinate_system<T[N]> \
0110 { \
0111 typedef CoordinateSystem type; \
0112 }; \
0113 }}}
0114
0115
0116 #endif