Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:27

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2021, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0006 
0007 // Licensed under the Boost Software License version 1.0.
0008 // http://www.boost.org/users/license.html
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 } // namespace detail
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 } // namespace traits
0074 
0075 
0076 }} // namespace boost::geometry
0077 
0078 
0079 #endif // BOOST_NO_CXX17_HDR_ANY
0080 
0081 
0082 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_ANY_HPP