Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry Index
0002 //
0003 // R-tree nodes static visitor related code
0004 //
0005 // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
0006 //
0007 // Use, modification and distribution is subject to the Boost Software License,
0008 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_VISITOR_HPP
0012 #define BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_VISITOR_HPP
0013 
0014 #include <boost/variant/apply_visitor.hpp>
0015 #include <boost/variant/get.hpp>
0016 #include <boost/variant/variant.hpp>
0017 
0018 namespace boost { namespace geometry { namespace index {
0019 
0020 namespace detail { namespace rtree {
0021 
0022 // nodes variants forward declarations
0023 
0024 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0025 struct variant_internal_node;
0026 
0027 template <typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0028 struct variant_leaf;
0029 
0030 // nodes conversion
0031 
0032 template <typename V, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0033 inline V & get(
0034     boost::variant<
0035         variant_leaf<Value, Parameters, Box, Allocators, Tag>,
0036         variant_internal_node<Value, Parameters, Box, Allocators, Tag>
0037     > & v)
0038 {
0039     return boost::get<V>(v);
0040 }
0041 
0042 // apply visitor
0043 
0044 template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0045 inline void apply_visitor(Visitor & v,
0046                           boost::variant<
0047                               variant_leaf<Value, Parameters, Box, Allocators, Tag>,
0048                               variant_internal_node<Value, Parameters, Box, Allocators, Tag>
0049                           > & n)
0050 {
0051     boost::apply_visitor(v, n);
0052 }
0053 
0054 template <typename Visitor, typename Value, typename Parameters, typename Box, typename Allocators, typename Tag>
0055 inline void apply_visitor(Visitor & v,
0056                           boost::variant<
0057                               variant_leaf<Value, Parameters, Box, Allocators, Tag>,
0058                               variant_internal_node<Value, Parameters, Box, Allocators, Tag>
0059                           > const& n)
0060 {
0061     boost::apply_visitor(v, n);
0062 }
0063 
0064 }} // namespace detail::rtree
0065 
0066 }}} // namespace boost::geometry::index
0067 
0068 #endif // BOOST_GEOMETRY_INDEX_DETAIL_RTREE_NODE_VARIANT_VISITOR_HPP