// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2008-2012 Bruno Lalande, Paris, France. // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2009-2012 Mateusz Loskot, London, UK. // This file was modified by Oracle on 2018-2021. // Modifications copyright (c) 2018-2021, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_VARIANT_HPP #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_VARIANT_HPP #include #include #include //#include #include #include #include #include #include #include namespace boost { namespace geometry { namespace detail { template > struct boost_variant_types; template struct boost_variant_types, util::type_sequence> { using type = typename boost_variant_types, util::type_sequence>::type; }; template struct boost_variant_types, util::type_sequence> { using type = util::type_sequence; }; template struct boost_variant_types, util::type_sequence> { using type = util::type_sequence; }; } // namespace detail // TODO: This is not used anywhere in the header files. Only in tests. template struct point_type > : point_type < typename util::pack_front < BOOST_VARIANT_ENUM_PARAMS(T) >::type > {}; namespace traits { template struct tag> { using type = dynamic_geometry_tag; }; template struct visit> { template struct visitor : boost::static_visitor<> { visitor(Function function) : m_function(function) {} template void operator()(Geometry && geometry) { m_function(std::forward(geometry)); } Function m_function; }; template static void apply(Function function, Variant && variant) { visitor visitor(function); boost::apply_visitor(visitor, std::forward(variant)); } }; template struct visit, boost::variant> { template struct visitor : boost::static_visitor<> { visitor(Function function) : m_function(function) {} template void operator()(Geometry1 && geometry1, Geometry2 && geometry2) { m_function(std::forward(geometry1), std::forward(geometry2)); } Function m_function; }; template static void apply(Function function, Variant1 && variant1, Variant2 && variant2) { visitor visitor(function); boost::apply_visitor(visitor, std::forward(variant1), std::forward(variant2)); } }; #ifdef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES template struct geometry_types> { using type = typename geometry::detail::boost_variant_types < util::type_sequence >::type; }; #else // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES template struct geometry_types> { using type = util::type_sequence; }; #endif // BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES } // namespace traits }} // namespace boost::geometry #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_VARIANT_HPP