123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- // Boost.Geometry
- // Copyright (c) 2021, Oracle and/or its affiliates.
- // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
- // Licensed under the Boost Software License version 1.0.
- // http://www.boost.org/users/license.html
- #ifndef BOOST_GEOMETRY_INDEX_DETAIL_MAXMIN_HEAP_HPP
- #define BOOST_GEOMETRY_INDEX_DETAIL_MAXMIN_HEAP_HPP
- #include <boost/geometry/index/detail/minmax_heap.hpp>
- namespace boost { namespace geometry { namespace index { namespace detail
- {
- template <typename It, typename Compare>
- inline void push_maxmin_heap(It first, It last, Compare comp)
- {
- using namespace minmax_heap_detail;
- minmax_heap_detail::push_heap<max_call, min_call>(first, last, comp);
- }
- template <typename It>
- inline void push_maxmin_heap(It first, It last)
- {
- using namespace minmax_heap_detail;
- minmax_heap_detail::push_heap<max_call, min_call>(first, last, std::less<>());
- }
- template <typename It, typename Compare>
- inline void pop_top_maxmin_heap(It first, It last, Compare comp)
- {
- using namespace minmax_heap_detail;
- pop_heap<max_call, min_call>(first, first, last, comp);
- }
- template <typename It>
- inline void pop_top_maxmin_heap(It first, It last)
- {
- using namespace minmax_heap_detail;
- pop_heap<max_call, min_call>(first, first, last, std::less<>());
- }
- template <typename It, typename Compare>
- inline void pop_bottom_maxmin_heap(It first, It last, Compare comp)
- {
- using namespace minmax_heap_detail;
- It bottom = minmax_heap_detail::bottom_heap<max_call>(first, last, comp);
- pop_heap<max_call, min_call>(first, bottom, last, comp);
- }
- template <typename It>
- inline void pop_bottom_maxmin_heap(It first, It last)
- {
- using namespace minmax_heap_detail;
- auto&& comp = std::less<>();
- It bottom = minmax_heap_detail::bottom_heap<max_call>(first, last, comp);
- pop_heap<max_call, min_call>(first, bottom, last, comp);
- }
- template <typename It, typename Compare>
- inline void make_maxmin_heap(It first, It last, Compare comp)
- {
- using namespace minmax_heap_detail;
- return minmax_heap_detail::make_heap<max_call, min_call>(first, last, comp);
- }
- template <typename It>
- inline void make_maxmin_heap(It first, It last)
- {
- using namespace minmax_heap_detail;
- return minmax_heap_detail::make_heap<max_call, min_call>(first, last, std::less<>());
- }
- template <typename It, typename Compare>
- inline bool is_maxmin_heap(It first, It last, Compare comp)
- {
- using namespace minmax_heap_detail;
- return minmax_heap_detail::is_heap<max_call>(first, last, comp);
- }
- template <typename It>
- inline bool is_maxmin_heap(It first, It last)
- {
- using namespace minmax_heap_detail;
- return minmax_heap_detail::is_heap<max_call>(first, last, std::less<>());
- }
- template <typename It, typename Compare>
- inline decltype(auto) bottom_maxmin_heap(It first, It last, Compare comp)
- {
- using namespace minmax_heap_detail;
- return *minmax_heap_detail::bottom_heap<max_call>(first, last, comp);
- }
- template <typename It>
- inline decltype(auto) bottom_maxmin_heap(It first, It last)
- {
- using namespace minmax_heap_detail;
- return *minmax_heap_detail::bottom_heap<max_call>(first, last, std::less<>());
- }
- }}}} // namespace boost::geometry::index::detail
- #endif // BOOST_GEOMETRY_INDEX_DETAIL_MAXMIN_HEAP_HPP
|