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_VARIANT_HPP
0011 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_VARIANT_HPP
0012 
0013 
0014 #include <boost/config.hpp>
0015 
0016 #ifndef BOOST_NO_CXX17_HDR_VARIANT
0017 
0018 
0019 #include <utility>
0020 #include <variant>
0021 
0022 #include <boost/geometry/core/geometry_types.hpp>
0023 #include <boost/geometry/core/tag.hpp>
0024 #include <boost/geometry/core/tags.hpp>
0025 #include <boost/geometry/core/visit.hpp>
0026 #include <boost/geometry/util/sequence.hpp>
0027 
0028 
0029 namespace boost { namespace geometry
0030 {
0031 
0032 namespace traits
0033 {
0034 
0035 template <typename ...Ts>
0036 struct tag<std::variant<Ts...>>
0037 {
0038     using type = dynamic_geometry_tag;
0039 };
0040 
0041 template <typename ...Ts>
0042 struct visit<std::variant<Ts...>>
0043 {
0044     template <typename Function, typename Variant>
0045     static void apply(Function && function, Variant && variant)
0046     {
0047         std::visit(std::forward<Function>(function),
0048                    std::forward<Variant>(variant));
0049     }
0050 };
0051 
0052 template <typename ...Ts, typename ...Us>
0053 struct visit<std::variant<Ts...>, std::variant<Us...>>
0054 {
0055     template <typename Function, typename Variant1, typename Variant2>
0056     static void apply(Function && function, Variant1 && variant1, Variant2 && variant2)
0057     {
0058         std::visit(std::forward<Function>(function),
0059                    std::forward<Variant1>(variant1),
0060                    std::forward<Variant2>(variant2));
0061     }
0062 };
0063 
0064 template <typename ...Ts>
0065 struct geometry_types<std::variant<Ts...>>
0066 {
0067     using type = util::type_sequence<Ts...>;
0068 };
0069 
0070 
0071 } // namespace traits
0072 
0073 
0074 }} // namespace boost::geometry
0075 
0076 
0077 #endif // BOOST_NO_CXX17_HDR_VARIANT
0078 
0079 
0080 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_STD_VARIANT_HPP