File indexing completed on 2025-01-18 09:35:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_ANY_HPP
0011 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_ANY_HPP
0012
0013
0014 #include <boost/config.hpp>
0015
0016 #ifndef BOOST_NO_CXX17_HDR_ANY
0017
0018
0019 #include <any>
0020 #include <utility>
0021
0022 #include <boost/geometry/geometries/adapted/detail/any.hpp>
0023
0024 #include <boost/geometry/core/geometry_types.hpp>
0025 #include <boost/geometry/core/tag.hpp>
0026 #include <boost/geometry/core/tags.hpp>
0027 #include <boost/geometry/core/visit.hpp>
0028
0029
0030 namespace boost { namespace geometry
0031 {
0032
0033 namespace detail
0034 {
0035
0036
0037 struct std_any_cast_policy
0038 {
0039 template <typename T, typename Any>
0040 static inline T * apply(Any * any_ptr)
0041 {
0042 return std::any_cast<T>(any_ptr);
0043 }
0044 };
0045
0046
0047 }
0048
0049 namespace traits
0050 {
0051
0052 template <>
0053 struct tag<std::any>
0054 {
0055 using type = dynamic_geometry_tag;
0056 };
0057
0058 template <>
0059 struct visit<std::any>
0060 {
0061 template <typename Function, typename Any>
0062 static void apply(Function && function, Any && any)
0063 {
0064 using types_t = typename geometry_types<util::remove_cref_t<Any>>::type;
0065 geometry::detail::visit_any
0066 <
0067 geometry::detail::std_any_cast_policy, types_t
0068 >::template apply<0>(std::forward<Function>(function), std::forward<Any>(any));
0069 }
0070 };
0071
0072
0073 }
0074
0075
0076 }}
0077
0078
0079 #endif
0080
0081
0082 #endif