Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template priority_queue

boost::heap::priority_queue — priority queue, based on stl heap functions

Synopsis

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

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

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

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

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

Description

The priority_queue class is a wrapper for the stl heap functions.
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::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> >

priority_queue public types

  1. typedef ;

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

priority_queue public construct/copy/destruct

  1. ( cmp = );

    Effects: constructs an empty priority queue.

    Complexity: Constant.

  2. (priority_queue  rhs);

    Effects: copy-constructs priority queue from rhs.

    Complexity: Linear.

  3. (priority_queue && rhs) ;

    Effects: C++11-style move constructor.

    Complexity: Constant.

    Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined

  4. priority_queue & 
    (priority_queue && rhs) ;

    Effects: C++11-style move assignment.

    Complexity: Constant.

    Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined

  5. priority_queue & (priority_queue  rhs);

    Effects: Assigns priority queue from rhs.

    Complexity: Linear.

priority_queue 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.  ();

    Effects: Removes the top element from the priority queue.

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

  10.  (priority_queue & rhs) ;

    Effects: Swaps two priority queues.

    Complexity: Constant.

  11.  () ;

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

    Complexity: Constant.

  12.  () ;

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

    Complexity: Constant.

  13.  ( element_count);

    Effects: Reserves memory for element_count elements

    Complexity: Linear.

    Node: Invalidates iterators

  14.  () ;

    Effect: Returns the value_compare object used by the priority queue

  15. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  16. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  17. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  18. template<typename HeapType>  ( rhs) ;

    Returns: Element-wise comparison of heap data structures

    Requirement: the value_compare object of both heaps must match.

  19. 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.

  20. 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.


PrevUpHomeNext