GNU g++  v5.2.1
GNU Standard C++
__gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc > Class Template Reference

Binary heaps composed of resize and compare policies. More...

#include <binary_heap_.hpp>

Inheritance diagram for __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >:
Collaboration diagram for __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >:

Public Types

typedef _Alloc allocator_type
 
typedef Cmp_Fn cmp_fn
 
typedef cond_dealtor< value_type, _Alloc > cond_dealtor_t
 
typedef binary_heap_const_iterator_< value_type, entry, simple_value, _Alloc > const_iterator
 
typedef value_allocator::const_pointer const_pointer
 
typedef value_allocator::const_reference const_reference
 
typedef _Alloc::difference_type difference_type
 
typedef __conditional_type< simple_value, value_type, pointer >::__type entry
 
typedef _Alloc::template rebind< entry >::other entry_allocator
 
typedef entry_cmp< Value_Type, Cmp_Fn, _Alloc, is_simple< Value_Type >::value >::type entry_cmp
 
typedef entry_allocator::pointer entry_pointer
 
typedef const_iterator iterator
 
typedef binary_heap_point_const_iterator_< value_type, entry, simple_value, _Alloc > point_const_iterator
 
typedef point_const_iterator point_iterator
 
typedef value_allocator::pointer pointer
 
typedef value_allocator::reference reference
 
typedef __gnu_pbds::detail::resize_policy< typename _Alloc::size_type > resize_policy
 
typedef _Alloc::size_type size_type
 
typedef Value_Type value_type
 

Public Member Functions

 binary_heap ()
 
 binary_heap (const cmp_fn &)
 
 binary_heap (const binary_heap &)
 
 ~binary_heap ()
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
void erase (point_iterator)
 
void erase_at (entry_pointer, size_type, false_type)
 
void erase_at (entry_pointer, size_type, true_type)
 
template<typename Pred >
size_type erase_if (Pred)
 
Cmp_Fn & get_cmp_fn ()
 
const Cmp_Fn & get_cmp_fn () const
 
size_type get_new_size_for_arbitrary (size_type) const
 
size_type get_new_size_for_grow () const
 
size_type get_new_size_for_shrink () const
 
bool grow_needed (size_type) const
 
void join (binary_heap &)
 
size_type max_size () const
 
void modify (point_iterator, const_reference)
 
void notify_arbitrary (size_type)
 
void notify_grow_resize ()
 
void notify_shrink_resize ()
 
void pop ()
 
point_iterator push (const_reference)
 
bool resize_needed_for_grow (size_type) const
 
bool resize_needed_for_shrink (size_type) const
 
bool shrink_needed (size_type) const
 
size_type size () const
 
template<typename Pred >
void split (Pred, binary_heap &)
 
void swap (resize_policy< _Alloc::size_type > &)
 
void swap (binary_heap &)
 
const_reference top () const
 

Static Public Attributes

static const _Alloc::size_type min_size
 

Protected Member Functions

template<typename It >
void copy_from_range (It, It)
 

Private Types

enum  { simple_value = is_simple<value_type>::value }
 
typedef _Alloc::template rebind< value_type__rebind_v
 
typedef integral_constant< int, simple_valueno_throw_copies_t
 
typedef __rebind_v::other value_allocator
 

Private Member Functions

void fix (entry_pointer)
 
void insert_value (const_reference, false_type)
 
void insert_value (value_type, true_type)
 
bool is_heap ()
 
void make_heap ()
 
template<typename Pred >
size_type partition (Pred)
 
void pop_heap ()
 
void push_heap ()
 
void resize_for_erase_if_needed ()
 
void resize_for_insert_if_needed ()
 
void swap_value_imp (entry_pointer, value_type, true_type)
 
void swap_value_imp (entry_pointer, const_reference, false_type)
 
const_reference top_imp (true_type) const
 
const_reference top_imp (false_type) const
 
void value_swap (binary_heap &)
 

Static Private Member Functions

static size_type left_child (size_type)
 
static size_type parent (size_type)
 
static size_type right_child (size_type)
 

Private Attributes

entry_pointer m_a_entries
 
size_type m_actual_size
 
size_type m_size
 

Static Private Attributes

static entry_allocator s_entry_allocator
 
static no_throw_copies_t s_no_throw_copies_ind
 
static value_allocator s_value_allocator
 

Detailed Description

template<typename Value_Type, typename Cmp_Fn, typename _Alloc>
class __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >

Binary heaps composed of resize and compare policies.

Based on CLRS.

Member Typedef Documentation

template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef _Alloc::template rebind<value_type> __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::__rebind_v
private
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef _Alloc __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::allocator_type
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef Cmp_Fn __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::cmp_fn
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef cond_dealtor<value_type, _Alloc> __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::cond_dealtor_t
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef binary_heap_const_iterator_<value_type, entry, simple_value, _Alloc> __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::const_iterator
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef value_allocator::const_pointer __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::const_pointer
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef value_allocator::const_reference __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::const_reference
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef _Alloc::difference_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::difference_type
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef __conditional_type<simple_value, value_type, pointer>::__type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::entry
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef _Alloc::template rebind<entry>::other __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::entry_allocator
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef entry_cmp<Value_Type, Cmp_Fn, _Alloc, is_simple<Value_Type>::value>::type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::entry_cmp
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef entry_allocator::pointer __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::entry_pointer
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef const_iterator __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::iterator
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef integral_constant<int, simple_value> __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::no_throw_copies_t
private
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef binary_heap_point_const_iterator_<value_type, entry, simple_value, _Alloc> __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::point_const_iterator
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef point_const_iterator __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::point_iterator
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef value_allocator::pointer __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::pointer
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef value_allocator::reference __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::reference
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef __gnu_pbds::detail::resize_policy<typename _Alloc::size_type> __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::resize_policy
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef _Alloc::size_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::size_type
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef __rebind_v::other __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::value_allocator
private
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
typedef Value_Type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::value_type

Constructor & Destructor Documentation

template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
__gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::binary_heap ( )
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
__gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::binary_heap ( const cmp_fn )
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
__gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::binary_heap ( const binary_heap< Value_Type, Cmp_Fn, _Alloc > &  )
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
__gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::~binary_heap ( )

Member Function Documentation

template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
iterator __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::begin ( )
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
const_iterator __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::begin ( ) const
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::clear ( )
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
template<typename It >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::copy_from_range ( It  ,
It   
)
protected
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
bool __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::empty ( ) const
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
const_iterator __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::end ( ) const
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::erase ( point_iterator  )
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::erase_at ( entry_pointer  ,
size_type  ,
false_type   
)
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::erase_at ( entry_pointer  ,
size_type  ,
true_type   
)
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
template<typename Pred >
size_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::erase_if ( Pred  )
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::fix ( entry_pointer  )
private
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
Cmp_Fn& __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::get_cmp_fn ( )
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
const Cmp_Fn& __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::get_cmp_fn ( ) const
size_type __gnu_pbds::detail::resize_policy< _Alloc::size_type >::get_new_size_for_arbitrary ( size_type  ) const
inlineinherited
size_type __gnu_pbds::detail::resize_policy< _Alloc::size_type >::get_new_size_for_grow ( ) const
inlineinherited
size_type __gnu_pbds::detail::resize_policy< _Alloc::size_type >::get_new_size_for_shrink ( ) const
inlineinherited
bool __gnu_pbds::detail::resize_policy< _Alloc::size_type >::grow_needed ( size_type  ) const
inlineinherited
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::insert_value ( const_reference  ,
false_type   
)
inlineprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::insert_value ( value_type  ,
true_type   
)
inlineprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
bool __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::is_heap ( )
inlineprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::join ( binary_heap< Value_Type, Cmp_Fn, _Alloc > &  )
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
static size_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::left_child ( size_type  )
inlinestaticprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
size_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::max_size ( ) const
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::modify ( point_iterator  ,
const_reference   
)
void __gnu_pbds::detail::resize_policy< _Alloc::size_type >::notify_arbitrary ( size_type  )
inherited
void __gnu_pbds::detail::resize_policy< _Alloc::size_type >::notify_grow_resize ( )
inlineinherited
void __gnu_pbds::detail::resize_policy< _Alloc::size_type >::notify_shrink_resize ( )
inlineinherited
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
static size_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::parent ( size_type  )
inlinestaticprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
template<typename Pred >
size_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::partition ( Pred  )
private
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::pop ( )
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::pop_heap ( )
inlineprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
point_iterator __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::push ( const_reference  )
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::resize_for_erase_if_needed ( )
inlineprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::resize_for_insert_if_needed ( )
inlineprivate
bool __gnu_pbds::detail::resize_policy< _Alloc::size_type >::resize_needed_for_grow ( size_type  ) const
inlineinherited
bool __gnu_pbds::detail::resize_policy< _Alloc::size_type >::resize_needed_for_shrink ( size_type  ) const
inlineinherited
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
static size_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::right_child ( size_type  )
inlinestaticprivate
bool __gnu_pbds::detail::resize_policy< _Alloc::size_type >::shrink_needed ( size_type  ) const
inlineinherited
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
size_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::size ( ) const
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
template<typename Pred >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::split ( Pred  ,
binary_heap< Value_Type, Cmp_Fn, _Alloc > &   
)
void __gnu_pbds::detail::resize_policy< _Alloc::size_type >::swap ( resize_policy< _Alloc::size_type > &  )
inlineinherited
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::swap ( binary_heap< Value_Type, Cmp_Fn, _Alloc > &  )
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::swap_value_imp ( entry_pointer  ,
value_type  ,
true_type   
)
inlineprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::swap_value_imp ( entry_pointer  ,
const_reference  ,
false_type   
)
inlineprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
const_reference __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::top ( ) const
inline
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
const_reference __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::top_imp ( true_type  ) const
inlineprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
const_reference __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::top_imp ( false_type  ) const
inlineprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
void __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::value_swap ( binary_heap< Value_Type, Cmp_Fn, _Alloc > &  )
private

Member Data Documentation

template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
size_type __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::m_actual_size
private
const _Alloc::size_type __gnu_pbds::detail::resize_policy< _Alloc::size_type >::min_size
staticinherited
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
entry_allocator __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::s_entry_allocator
staticprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
no_throw_copies_t __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::s_no_throw_copies_ind
staticprivate
template<typename Value_Type , typename Cmp_Fn , typename _Alloc >
value_allocator __gnu_pbds::detail::binary_heap< Value_Type, Cmp_Fn, _Alloc >::s_value_allocator
staticprivate

The documentation for this class was generated from the following file: