Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template d_ary_heap

boost::heap::d_ary_heap — d-ary heap class

Synopsis

// In header: <boost/heap/d_ary_heap.hpp>

template<typename T,  Options> 
class d_ary_heap {
public:
  // types
  typedef                                         ;      
  typedef         ;       
  typedef   ; 
  typedef     ;   
  typedef    ;  
  typedef         ;       
  typedef   ; 
  typedef           ;         
  typedef     ;   
  typedef          ;        
  typedef    ;  
  typedef  ;
  typedef       ;     

  // construct/copy/destruct
  ( = );
  (d_ary_heap );
  (d_ary_heap &&);
  d_ary_heap & (d_ary_heap &&);
  d_ary_heap & (d_ary_heap );

  // public member functions
   () ;
   () ;
   () ;
   ();
   () ;
   () ;
   
  ();
  template< Args> 
     
    ();
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;
  template<typename HeapType>  () ;
   (, );
   ();
   (, );
   ();
   (, );
   ();
   ();
   ();
   (d_ary_heap &);
   () ;
   ();
   ();
   () ;
   () ;
   () ;
   ();
   () ;

  // public static functions
   ();

  // public data members
  static  constant_time_size;
  static  has_ordered_iterators;
  static  is_mergable;
  static  has_reserve;
  static  is_stable;
};

Description

This class implements an immutable priority queue. Internally, the d-ary heap is represented as dynamically sized array (std::vector), that directly stores the values.

The template parameter T is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options:

  • boost::heap::arity<>, required

  • boost::heap::compare<>, defaults to compare<std::less<T> >

  • boost::heap::stable<>, defaults to stable<false>

  • boost::heap::stability_counter_type<>, defaults to stability_counter_type<boost::uintmax_t>

  • boost::heap::allocator<>, defaults to allocator<std::allocator<T> >

  • boost::heap::mutable_<>, defaults to mutable_<false>

d_ary_heap public types

  1. typedef ;

    Note: The iterator does not traverse the priority queue in order of the priorities.

d_ary_heap public construct/copy/destruct

  1. ( cmp = );

    Effects: constructs an empty priority queue.

    Complexity: Constant.

  2. (d_ary_heap  rhs);

    Effects: copy-constructs priority queue from rhs.

    Complexity: Linear.

  3. (d_ary_heap && rhs);

    Effects: C++11-style move constructor.

    Complexity: Constant.

    Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined

  4. d_ary_heap & (d_ary_heap && rhs);

    Effects: C++11-style move assignment.

    Complexity: Constant.

    Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined

  5. d_ary_heap & (d_ary_heap  rhs);

    Effects: Assigns priority queue from rhs.

    Complexity: Linear.

d_ary_heap public member functions

  1.  () ;

    Effects: Returns true, if the priority queue contains no elements.

    Complexity: Constant.

  2.  () ;

    Effects: Returns the number of elements contained in the priority queue.

    Complexity: Constant.

  3.  () ;

    Effects: Returns the maximum number of elements the priority queue can contain.

    Complexity: Constant.

  4.  ();

    Effects: Removes all elements from the priority queue.

    Complexity: Linear.

  5.  () ;

    Effects: Returns allocator.

    Complexity: Constant.

  6.  () ;

    Effects: Returns a const_reference to the maximum element.

    Complexity: Constant.

  7.  
    ( v);

    Effects: Adds a new element to the priority queue.

    Complexity: Logarithmic (amortized). Linear (worst case).

  8. template< Args> 
       
      ( args);

    Effects: Adds a new element to the priority queue. The element is directly constructed in-place.

    Complexity: Logarithmic (amortized). Linear (worst case).

  9. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  10. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  11. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  12. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  13. template<typename HeapType>  ( rhs) ;
    Equivalent comparison Returns: True, if both heap data structures are equivalent.

    Requirement: the value_compare object of both heaps must match.

  14. template<typename HeapType>  ( rhs) ;
    Equivalent comparison Returns: True, if both heap data structures are not equivalent.

    Requirement: the value_compare object of both heaps must match.

  15.  ( handle,  v);

    Effects: Assigns v to the element handled by handle & updates the priority queue.

    Complexity: Logarithmic.

    Requirement: data structure must be configured as mutable

  16.  ( handle);

    Effects: Updates the heap after the element handled by handle has been changed.

    Complexity: Logarithmic.

    Note: If this is not called, after a handle has been updated, the behavior of the data structure is undefined!

    Requirement: data structure must be configured as mutable

  17.  ( handle,  v);

    Effects: Assigns v to the element handled by handle & updates the priority queue.

    Complexity: Logarithmic.

    Note: The new value is expected to be greater than the current one

    Requirement: data structure must be configured as mutable

  18.  ( handle);

    Effects: Updates the heap after the element handled by handle has been changed.

    Complexity: Logarithmic.

    Note: The new value is expected to be greater than the current one. If this is not called, after a handle has been updated, the behavior of the data structure is undefined!

    Requirement: data structure must be configured as mutable

  19.  ( handle,  v);

    Effects: Assigns v to the element handled by handle & updates the priority queue.

    Complexity: Logarithmic.

    Note: The new value is expected to be less than the current one

    Requirement: data structure must be configured as mutable

  20.  ( handle);

    Effects: Updates the heap after the element handled by handle has been changed.

    Complexity: Logarithmic.

    Note: The new value is expected to be less than the current one. If this is not called, after a handle has been updated, the behavior of the data structure is undefined!

    Requirement: data structure must be configured as mutable

  21.  ( handle);

    Effects: Removes the element handled by handle from the priority_queue.

    Complexity: Logarithmic.

    Requirement: data structure must be configured as mutable

  22.  ();

    Effects: Removes the top element from the priority queue.

    Complexity: Logarithmic (amortized). Linear (worst case).

  23.  (d_ary_heap & rhs);

    Effects: Swaps two priority queues.

    Complexity: Constant.

  24.  () ;

    Effects: Returns an iterator to the first element contained in the priority queue.

    Complexity: Constant.

  25.  ();

    Effects: Returns an iterator to the first element contained in the priority queue.

    Complexity: Constant.

  26.  ();

    Effects: Returns an iterator to the end of the priority queue.

    Complexity: Constant.

  27.  () ;

    Effects: Returns an iterator to the end of the priority queue.

    Complexity: Constant.

  28.  () ;

    Effects: Returns an ordered iterator to the first element contained in the priority queue.

    Note: Ordered iterators traverse the priority queue in heap order.

  29.  () ;

    Effects: Returns an ordered iterator to the end of the priority queue.

    Note: Ordered iterators traverse the priority queue in heap order.

  30.  ( element_count);

    Effects: Reserves memory for element_count elements

    Complexity: Linear.

    Node: Invalidates iterators

  31.  () ;

    Effect: Returns the value_compare object used by the priority queue

d_ary_heap public static functions

  1.  ( it);

    Effects: Casts an iterator to a node handle.

    Complexity: Constant.

    Requirement: data structure must be configured as mutable


PrevUpHomeNext