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_BOOST_ANY_HPP
0011 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_ANY_HPP
0012
0013
0014 #include <utility>
0015
0016 #include <boost/any.hpp>
0017
0018 #include <boost/geometry/geometries/adapted/detail/any.hpp>
0019
0020 #include <boost/geometry/core/geometry_types.hpp>
0021 #include <boost/geometry/core/tag.hpp>
0022 #include <boost/geometry/core/tags.hpp>
0023 #include <boost/geometry/core/visit.hpp>
0024
0025
0026 namespace boost { namespace geometry
0027 {
0028
0029 namespace detail
0030 {
0031
0032
0033 struct boost_any_cast_policy
0034 {
0035 template <typename T, typename Any>
0036 static inline T * apply(Any * any_ptr)
0037 {
0038 return boost::any_cast<T>(any_ptr);
0039 }
0040 };
0041
0042
0043 }
0044
0045 namespace traits
0046 {
0047
0048 template <>
0049 struct tag<boost::any>
0050 {
0051 using type = dynamic_geometry_tag;
0052 };
0053
0054 template <>
0055 struct visit<boost::any>
0056 {
0057 template <typename Function, typename Any>
0058 static void apply(Function && function, Any && any)
0059 {
0060 using types_t = typename geometry_types<util::remove_cref_t<Any>>::type;
0061 geometry::detail::visit_any
0062 <
0063 geometry::detail::boost_any_cast_policy, types_t
0064 >::template apply<0>(std::forward<Function>(function), std::forward<Any>(any));
0065 }
0066 };
0067
0068
0069 }
0070
0071
0072 }}
0073
0074
0075 #endif