Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2021, Oracle and/or its affiliates.
0004 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0005 
0006 // Licensed under the Boost Software License version 1.0.
0007 // http://www.boost.org/users/license.html
0008 
0009 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_MAXMIN_HEAP_HPP
0010 #define BOOST_GEOMETRY_INDEX_DETAIL_MAXMIN_HEAP_HPP
0011 
0012 #include <boost/geometry/index/detail/minmax_heap.hpp>
0013 
0014 namespace boost { namespace geometry { namespace index { namespace detail
0015 {
0016 
0017 template <typename It, typename Compare>
0018 inline void push_maxmin_heap(It first, It last, Compare comp)
0019 {
0020     using namespace minmax_heap_detail;
0021     minmax_heap_detail::push_heap<max_call, min_call>(first, last, comp);
0022 }
0023 
0024 template <typename It>
0025 inline void push_maxmin_heap(It first, It last)
0026 {
0027     using namespace minmax_heap_detail;
0028     minmax_heap_detail::push_heap<max_call, min_call>(first, last, std::less<>());
0029 }
0030 
0031 template <typename It, typename Compare>
0032 inline void pop_top_maxmin_heap(It first, It last, Compare comp)
0033 {
0034     using namespace minmax_heap_detail;
0035     pop_heap<max_call, min_call>(first, first, last, comp);
0036 }
0037 
0038 template <typename It>
0039 inline void pop_top_maxmin_heap(It first, It last)
0040 {
0041     using namespace minmax_heap_detail;
0042     pop_heap<max_call, min_call>(first, first, last, std::less<>());
0043 }
0044 
0045 template <typename It, typename Compare>
0046 inline void pop_bottom_maxmin_heap(It first, It last, Compare comp)
0047 {
0048     using namespace minmax_heap_detail;
0049     It bottom = minmax_heap_detail::bottom_heap<max_call>(first, last, comp);
0050     pop_heap<max_call, min_call>(first, bottom, last, comp);
0051 }
0052 
0053 template <typename It>
0054 inline void pop_bottom_maxmin_heap(It first, It last)
0055 {
0056     using namespace minmax_heap_detail;
0057     auto&& comp = std::less<>();
0058     It bottom = minmax_heap_detail::bottom_heap<max_call>(first, last, comp);
0059     pop_heap<max_call, min_call>(first, bottom, last, comp);
0060 }
0061 
0062 template <typename It, typename Compare>
0063 inline void make_maxmin_heap(It first, It last, Compare comp)
0064 {
0065     using namespace minmax_heap_detail;
0066     return minmax_heap_detail::make_heap<max_call, min_call>(first, last, comp);
0067 }
0068 
0069 template <typename It>
0070 inline void make_maxmin_heap(It first, It last)
0071 {
0072     using namespace minmax_heap_detail;
0073     return minmax_heap_detail::make_heap<max_call, min_call>(first, last, std::less<>());
0074 }
0075 
0076 template <typename It, typename Compare>
0077 inline bool is_maxmin_heap(It first, It last, Compare comp)
0078 {
0079     using namespace minmax_heap_detail;
0080     return minmax_heap_detail::is_heap<max_call>(first, last, comp);
0081 }
0082 
0083 template <typename It>
0084 inline bool is_maxmin_heap(It first, It last)
0085 {
0086     using namespace minmax_heap_detail;
0087     return minmax_heap_detail::is_heap<max_call>(first, last, std::less<>());
0088 }
0089 
0090 template <typename It, typename Compare>
0091 inline decltype(auto) bottom_maxmin_heap(It first, It last, Compare comp)
0092 {
0093     using namespace minmax_heap_detail;
0094     return *minmax_heap_detail::bottom_heap<max_call>(first, last, comp);
0095 }
0096 
0097 template <typename It>
0098 inline decltype(auto) bottom_maxmin_heap(It first, It last)
0099 {
0100     using namespace minmax_heap_detail;
0101     return *minmax_heap_detail::bottom_heap<max_call>(first, last, std::less<>());
0102 }
0103 
0104 
0105 }}}} // namespace boost::geometry::index::detail
0106 
0107 #endif // BOOST_GEOMETRY_INDEX_DETAIL_MAXMIN_HEAP_HPP