Header file range/v3/algorithm/heap_algorithm.hpp

#include <meta/meta.hpp>

#include <range/v3/range_fwd.hpp>

#include <range/v3/distance.hpp>

#include <range/v3/begin_end.hpp>

#include <range/v3/range_concepts.hpp>

#include <range/v3/range_traits.hpp>

#include <range/v3/utility/iterator.hpp>

#include <range/v3/utility/iterator_concepts.hpp>

#include <range/v3/utility/iterator_traits.hpp>

#include <range/v3/utility/functional.hpp>

#include <range/v3/utility/static_const.hpp>

namespace ranges
{
    inline namespace v3
    {
        template <typename I, typename C = ordered_less, typename P = ident>
        using IsHeapable = meta::strict_and<RandomAccessIterator<I>, IndirectCallableRelation<C, projected<I, P>>>;
        
        namespace detail
        {
            struct is_heap_until_n_fn
            {
                template <typename I, typename C = ordered_less, typename P = ident, int _concept_requires_53 = 42, typename std::enable_if<(_concept_requires_53==43)||(IsHeapable<I, C, P>()), int>::type=0>
                I operator()(I const begin_, iterator_difference_t<I>const n_, C pred_ = C{}, P proj_ = P{}) const;
            };
            
            inline namespace 
            {
                constexpr auto& is_heap_until_n = static_const<is_heap_until_n_fn>::value;
            }
            
            struct is_heap_n_fn
            {
                template <typename I, typename C = ordered_less, typename P = ident, int _concept_requires_83 = 42, typename std::enable_if<(_concept_requires_83==43)||(IsHeapable<I, C, P>()), int>::type=0>
                bool operator()(I begin, iterator_difference_t<I> n, C pred = C{}, P proj = P{}) const;
            };
            
            inline namespace 
            {
                constexpr auto& is_heap_n = static_const<is_heap_n_fn>::value;
            }
        }
        
        struct is_heap_until_fn;
        
        inline namespace 
        {
            constexpr auto& is_heap_until = static_const<with_braced_init_args<is_heap_until_fn>>::value;
        }
        
        struct is_heap_fn
        {
            template <typename I, typename S, typename C = ordered_less, typename P = ident, int _concept_requires_124 = 42, typename std::enable_if<(_concept_requires_124==43)||(IsHeapable<I, C, P>()&&Sentinel<S, I>()), int>::type=0>
            bool operator()(I begin, S end, C pred = C{}, P proj = P{}) const;
            
            template <typename Rng, typename C = ordered_less, typename P = ident, typename I = range_iterator_t<Rng>, int _concept_requires_133 = 42, typename std::enable_if<(_concept_requires_133==43)||(IsHeapable<I, C, P>()&&Range<Rng>()), int>::type=0>
            bool operator()(Rng&& rng, C pred = C{}, P proj = P{}) const;
        };
        
        inline namespace 
        {
            constexpr auto& is_heap = static_const<with_braced_init_args<is_heap_fn>>::value;
        }
        
        namespace detail
        {
            struct sift_up_n_fn
            {
                template <typename I, typename C = ordered_less, typename P = ident>
                void operator()(I begin, iterator_difference_t<I> len, C pred_ = C{}, P proj_ = P{}) const;
            };
            
            inline namespace 
            {
                constexpr auto& sift_up_n = static_const<sift_up_n_fn>::value;
            }
            
            struct sift_down_n_fn
            {
                template <typename I, typename C = ordered_less, typename P = ident>
                void operator()(I begin, iterator_difference_t<I> len, I start, C pred_ = C{}, P proj_ = P{}) const;
            };
            
            inline namespace 
            {
                constexpr auto& sift_down_n = static_const<sift_down_n_fn>::value;
            }
        }
        
        struct push_heap_fn;
        
        inline namespace 
        {
            constexpr auto& push_heap = static_const<with_braced_init_args<push_heap_fn>>::value;
        }
        
        namespace detail
        {
            struct pop_heap_n_fn
            {
                template <typename I, typename C = ordered_less, typename P = ident, int _concept_requires_277 = 42, typename std::enable_if<(_concept_requires_277==43)||(RandomAccessIterator<I>()&&Sortable<I, C, P>()), int>::type=0>
                void operator()(I begin, iterator_difference_t<I> len, C pred = C{}, P proj = P{}) const;
            };
            
            inline namespace 
            {
                constexpr auto& pop_heap_n = static_const<pop_heap_n_fn>::value;
            }
        }
        
        struct pop_heap_fn;
        
        inline namespace 
        {
            constexpr auto& pop_heap = static_const<with_braced_init_args<pop_heap_fn>>::value;
        }
        
        struct make_heap_fn
        {
            template <typename I, typename S, typename C = ordered_less, typename P = ident, int _concept_requires_325 = 42, typename std::enable_if<(_concept_requires_325==43)||(RandomAccessIterator<I>()&&Sentinel<S, I>()&&Sortable<I, C, P>()), int>::type=0>
            I operator()(I begin, S end, C pred_ = C{}, P proj_ = P{}) const;
            
            template <typename Rng, typename C = ordered_less, typename P = ident, typename I = range_iterator_t<Rng>, int _concept_requires_340 = 42, typename std::enable_if<(_concept_requires_340==43)||(RandomAccessRange<Rng>()&&Sortable<I, C, P>()), int>::type=0>
            range_safe_iterator_t<Rng> operator()(Rng&& rng, C pred_ = C{}, P proj_ = P{}) const;
        };
        
        inline namespace 
        {
            constexpr auto& make_heap = static_const<with_braced_init_args<make_heap_fn>>::value;
        }
        
        struct sort_heap_fn
        {
            template <typename I, typename S, typename C = ordered_less, typename P = ident, int _concept_requires_362 = 42, typename std::enable_if<(_concept_requires_362==43)||(RandomAccessIterator<I>()&&Sentinel<S, I>()&&Sortable<I, C, P>()), int>::type=0>
            I operator()(I begin, S end, C pred_ = C{}, P proj_ = P{}) const;
            
            template <typename Rng, typename C = ordered_less, typename P = ident, typename I = range_iterator_t<Rng>, int _concept_requires_375 = 42, typename std::enable_if<(_concept_requires_375==43)||(RandomAccessRange<Rng&>()&&Sortable<I, C, P>()), int>::type=0>
            range_safe_iterator_t<Rng> operator()(Rng&& rng, C pred_ = C{}, P proj_ = P{}) const;
        };
        
        inline namespace 
        {
            constexpr auto& sort_heap = static_const<with_braced_init_args<sort_heap_fn>>::value;
        }
    }
}

Class ranges::v3::is_heap_until_fn

struct is_heap_until_fn
{
    template <typename I, typename S, typename C = ordered_less, typename P = ident, int _concept_requires_99 = 42, typename std::enable_if<(_concept_requires_99==43)||(IsHeapable<I, C, P>()&&Sentinel<S, I>()), int>::type=0>
    I operator()(I begin, S end, C pred = C{}, P proj = P{}) const;
    
    template <typename Rng, typename C = ordered_less, typename P = ident, typename I = range_iterator_t<Rng>, int _concept_requires_108 = 42, typename std::enable_if<(_concept_requires_108==43)||(IsHeapable<I, C, P>()&&Range<Rng>()), int>::type=0>
    range_safe_iterator_t<Rng> operator()(Rng&& rng, C pred = C{}, P proj = P{}) const;
};

@{


Variable ranges::v3::is_heap_until

constexpr auto& is_heap_until = static_const<with_braced_init_args<is_heap_until_fn>>::value;

is_heap_until_fn


Variable ranges::v3::is_heap

constexpr auto& is_heap = static_const<with_braced_init_args<is_heap_fn>>::value;

is_heap_fn


Class ranges::v3::push_heap_fn

struct push_heap_fn
{
    template <typename I, typename S, typename C = ordered_less, typename P = ident, int _concept_requires_246 = 42, typename std::enable_if<(_concept_requires_246==43)||(RandomAccessIterator<I>()&&Sentinel<S, I>()&&Sortable<I, C, P>()), int>::type=0>
    I operator()(I begin, S end, C pred = C{}, P proj = P{}) const;
    
    template <typename Rng, typename C = ordered_less, typename P = ident, typename I = range_iterator_t<Rng>, int _concept_requires_256 = 42, typename std::enable_if<(_concept_requires_256==43)||(RandomAccessRange<Rng>()&&Sortable<I, C, P>()), int>::type=0>
    range_safe_iterator_t<Rng> operator()(Rng&& rng, C pred = C{}, P proj = P{}) const;
};

@{


Variable ranges::v3::push_heap

constexpr auto& push_heap = static_const<with_braced_init_args<push_heap_fn>>::value;

push_heap_fn


Class ranges::v3::pop_heap_fn

struct pop_heap_fn
{
    template <typename I, typename S, typename C = ordered_less, typename P = ident, int _concept_requires_298 = 42, typename std::enable_if<(_concept_requires_298==43)||(RandomAccessIterator<I>()&&Sentinel<S, I>()&&Sortable<I, C, P>()), int>::type=0>
    I operator()(I begin, S end, C pred = C{}, P proj = P{}) const;
    
    template <typename Rng, typename C = ordered_less, typename P = ident, typename I = range_iterator_t<Rng>, int _concept_requires_308 = 42, typename std::enable_if<(_concept_requires_308==43)||(RandomAccessRange<Rng>()&&Sortable<I, C, P>()), int>::type=0>
    range_safe_iterator_t<Rng> operator()(Rng&& rng, C pred = C{}, P proj = P{}) const;
};

@{


Variable ranges::v3::pop_heap

constexpr auto& pop_heap = static_const<with_braced_init_args<pop_heap_fn>>::value;

pop_heap_fn


Variable ranges::v3::make_heap

constexpr auto& make_heap = static_const<with_braced_init_args<make_heap_fn>>::value;

make_heap_fn


Variable ranges::v3::sort_heap

constexpr auto& sort_heap = static_const<with_braced_init_args<sort_heap_fn>>::value;

sort_heap_fn