// Boost.Geometry // Copyright (c) 2024 Adam Wulkiewicz, Lodz, Poland. // Copyright (c) 2020-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html #ifndef BOOST_GEOMETRY_UTIL_TYPE_TRAITS_HPP #define BOOST_GEOMETRY_UTIL_TYPE_TRAITS_HPP #include #include #include namespace boost { namespace geometry { namespace util { template struct is_geometry : bool_constant>::value> {}; template struct is_not_geometry : std::is_void> {}; #ifndef BOOST_NO_CXX17_INLINE_VARIABLES template inline constexpr bool is_geometry_v = is_geometry::value; template inline constexpr bool is_not_geometry_v = is_not_geometry::value; #endif template struct is_point : std::is_same> {}; template struct is_multi_point : std::is_same> {}; template struct is_pointlike : std::is_base_of> {}; #ifndef BOOST_NO_CXX17_INLINE_VARIABLES template inline constexpr bool is_point_v = is_point::value; template inline constexpr bool is_multi_point_v = is_multi_point::value; template inline constexpr bool is_pointlike_v = is_pointlike::value; #endif template struct is_segment : std::is_same> {}; template struct is_linestring : std::is_same> {}; template struct is_multi_linestring : std::is_same> {}; template struct is_polylinear : std::is_base_of> {}; template struct is_linear : std::is_base_of> {}; #ifndef BOOST_NO_CXX17_INLINE_VARIABLES template inline constexpr bool is_segment_v = is_segment::value; template inline constexpr bool is_linestring_v = is_linestring::value; template inline constexpr bool is_multi_linestring_v = is_multi_linestring::value; template inline constexpr bool is_polylinear_v = is_polylinear::value; template inline constexpr bool is_linear_v = is_linear::value; #endif template struct is_box : std::is_same> {}; template struct is_ring : std::is_same> {}; template struct is_polygon : std::is_same> {}; template struct is_multi_polygon : std::is_same> {}; template struct is_polygonal : std::is_base_of> {}; template struct is_areal : std::is_base_of> {}; #ifndef BOOST_NO_CXX17_INLINE_VARIABLES template inline constexpr bool is_box_v = is_box::value; template inline constexpr bool is_ring_v = is_ring::value; template inline constexpr bool is_polygon_v = is_polygon::value; template inline constexpr bool is_multi_polygon_v = is_multi_polygon::value; template inline constexpr bool is_polygonal_v = is_polygonal::value; template inline constexpr bool is_areal_v = is_areal::value; #endif template struct is_segmental : bool_constant::value || is_polygonal::value> {}; template struct is_polysegmental : bool_constant::value || is_polygonal::value> {}; template struct is_multi : std::is_base_of> {}; template struct is_multi_element : bool_constant::value || is_linestring::value || is_polygon::value> {}; template struct is_single : std::is_base_of> {}; template struct is_geometry_collection : std::is_same> {}; template struct is_dynamic_geometry : std::is_same> {}; #ifndef BOOST_NO_CXX17_INLINE_VARIABLES template inline constexpr bool is_segmental_v = is_segmental::value; template inline constexpr bool is_polysegmental_v = is_polysegmental::value; template inline constexpr bool is_multi_v = is_multi::value; template inline constexpr bool is_multi_element_v = is_multi_element::value; template inline constexpr bool is_single_v = is_single::value; template inline constexpr bool is_geometry_collection_v = is_geometry_collection::value; template inline constexpr bool is_dynamic_geometry_v = is_dynamic_geometry::value; #endif template struct enable_if_point : std::enable_if::value, T> {}; template using enable_if_point_t = typename enable_if_point::type; template struct enable_if_multi_point : std::enable_if::value, T> {}; template using enable_if_multi_point_t = typename enable_if_multi_point::type; template struct enable_if_pointlike : std::enable_if::value, T> {}; template using enable_if_pointlike_t = typename enable_if_pointlike::type; template struct enable_if_segment : std::enable_if::value, T> {}; template using enable_if_segment_t = typename enable_if_segment::type; template struct enable_if_linestring : std::enable_if::value, T> {}; template using enable_if_linestring_t = typename enable_if_linestring::type; template struct enable_if_multi_linestring : std::enable_if::value, T> {}; template using enable_if_multi_linestring_t = typename enable_if_multi_linestring::type; template struct enable_if_polylinear : std::enable_if::value, T> {}; template using enable_if_polylinear_t = typename enable_if_polylinear::type; template struct enable_if_linear : std::enable_if::value, T> {}; template using enable_if_linear_t = typename enable_if_linear::type; template struct enable_if_box : std::enable_if::value, T> {}; template using enable_if_box_t = typename enable_if_box::type; template struct enable_if_ring : std::enable_if::value, T> {}; template using enable_if_ring_t = typename enable_if_ring::type; template struct enable_if_polygon : std::enable_if::value, T> {}; template using enable_if_polygon_t = typename enable_if_polygon::type; template struct enable_if_multi_polygon : std::enable_if::value, T> {}; template using enable_if_multi_polygon_t = typename enable_if_multi_polygon::type; template struct enable_if_polygonal : std::enable_if::value, T> {}; template using enable_if_polygonal_t = typename enable_if_polygonal::type; template struct enable_if_areal : std::enable_if::value, T> {}; template using enable_if_areal_t = typename enable_if_areal::type; template struct enable_if_polysegmental : std::enable_if::value, T> {}; template using enable_if_polysegmental_t = typename enable_if_polysegmental::type; template struct enable_if_dynamic_geometry : std::enable_if::value, T> {}; template using enable_if_dynamic_geometry_t = typename enable_if_dynamic_geometry::type; template struct enable_if_geometry_collection : std::enable_if::value, T> {}; template using enable_if_geometry_collection_t = typename enable_if_geometry_collection::type; } // namespace util // Deprecated utilities, defined for backward compatibility but might be // removed in the future. /*! \brief Meta-function defining "true" for areal types (box, (multi)polygon, ring), \note Used for tag dispatching and meta-function finetuning \note Also a "ring" has areal properties within Boost.Geometry \ingroup core */ template using is_areal [[deprecated("Use util::is_areal<> instead.")]] = util::is_areal; }} // namespace boost::geometry #endif // BOOST_GEOMETRY_STRATEGIES_DETAIL_HPP