// bslstl_priorityqueue_cpp03.h                                       -*-C++-*-

// Automatically generated file.  **DO NOT EDIT**

#ifndef INCLUDED_BSLSTL_PRIORITYQUEUE_CPP03
#define INCLUDED_BSLSTL_PRIORITYQUEUE_CPP03

//@PURPOSE: Provide C++03 implementation for bslstl_priorityqueue.h
//
//@CLASSES: See bslstl_priorityqueue.h for list of classes
//
//@SEE_ALSO: bslstl_priorityqueue
//
//@DESCRIPTION:  This component is the C++03 translation of a C++11 component,
// generated by the 'sim_cpp11_features.pl' program.  If the original header
// contains any specially delimited regions of C++11 code, then this generated
// file contains the C++03 equivalent, i.e., with variadic templates expanded
// and rvalue-references replaced by 'bslmf::MovableRef' objects.  The header
// code in this file is designed to be '#include'd into the original header
// when compiling with a C++03 compiler.  If there are no specially delimited
// regions of C++11 code, then this header contains no code and is not
// '#include'd in the original header.
//
// Generated on Fri May 15 12:19:50 2026
// Command line: sim_cpp11_features.pl bslstl_priorityqueue.h

#ifdef COMPILING_BSLSTL_PRIORITYQUEUE_H

namespace bsl {

                         // ====================
                         // class priority_queue
                         // ====================

/// This class is a value-semantic class template, adapting a container of
/// the (template parameter) type `CONTAINER`, that holds elements of the
/// (template parameter) type `VALUE`, to provide a highest-priority-first
/// priority queue data structure, where the priorities of elements are
/// compared by a comparator of the template parameter type, `COMPARATOR`.
/// The container object held by a `priority_queue` class object is
/// referenced as `c` in the following documentation.
template <class VALUE,
          class CONTAINER  = vector<VALUE>,
          class COMPARATOR = std::less<typename CONTAINER::value_type> >
class priority_queue {

#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
    // STATIC CHECK: Type mismatch is UB per C++17
    BSLMF_ASSERT((is_same<VALUE, typename CONTAINER::value_type>::value));
#endif

  private:
    // PRIVATE TYPES

    /// This `typedef` is a convenient alias for the utility associated with
    /// movable references.
    typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;

    // PRIVATE MANIPULATORS

    /// Push onto the back of the underlying container the elements of the
    /// specified `[first, last)` range.
    template <class INPUT_ITER, class SENTINEL>
    void privatePushRange(INPUT_ITER first, SENTINEL last);

  public:
    // PUBLIC TYPES
    typedef          CONTAINER                  container_type;
    typedef          COMPARATOR                 value_compare;
    typedef typename CONTAINER::value_type      value_type;
    typedef typename CONTAINER::reference       reference;
    typedef typename CONTAINER::const_reference const_reference;
    typedef typename CONTAINER::size_type       size_type;

  protected:
    // PROTECTED DATA
    CONTAINER  c;     // container for elements in the 'priority_queue'.  This
                      // data member exactly matches its definition in the
                      // C++11 standard [23.6.4].

    COMPARATOR comp;  // comparator that defines the priority order of elements
                      // in the 'priority_queue'.  This data member exactly
                      // matches its definition in the C++11 standard [23.6.4].

  public:
    // TRAITS
    BSLMF_NESTED_TRAIT_DECLARATION_IF(
        priority_queue,
        BloombergLP::bslma::UsesBslmaAllocator,
        BloombergLP::bslma::UsesBslmaAllocator<container_type>::value);

    // CREATORS

    /// Create an empty priority queue, adapting a default-constructed
    /// container of the (template parameter) type `CONTAINER`.  Use a
    /// default-constructed comparator of the (template parameter) type
    /// `COMPARATOR` to order elements in the priority queue.
    priority_queue();

    /// Create an empty priority queue, adapting a default-constructed
    /// container of the (template parameter) type `CONTAINER`, and having
    /// the specified `comparator` of the (template parameter) type
    /// `COMPARATOR` to order elements in the priority queue.
    explicit priority_queue(const COMPARATOR& comparator);

    /// Create a priority queue, adapting the specified `container` of the
    /// (template parameter) type `CONTAINER`, and having the specified
    /// `comparator` of the (template parameter) type `COMPARATOR` to order
    /// elements in the priority queue.
    priority_queue(const COMPARATOR& comparator, const CONTAINER& container);

    /// Create a priority queue, adapting the specified `container` of the
    /// (template parameter) type `CONTAINER`, and having the specified
    /// `comparator` of the (template parameter) type `COMPARATOR` to order
    /// elements in the priority queue.
    explicit priority_queue(
           const COMPARATOR&                         comparator,
           BloombergLP::bslmf::MovableRef<CONTAINER> container);


    /// Create a priority queue, adapting a default-constructed container of
    /// the (template parameter) type `CONTAINER`, and inserting into the
    /// container a sequence of `value_type` elements that starts at the
    /// specified `first` and ends immediately before the specified `last`.
    /// Use a default-constructed comparator of the (template parameter)
    /// type `COMPARATOR` to order elements in the priority queue.
    template <class INPUT_ITERATOR>
    priority_queue(INPUT_ITERATOR first, INPUT_ITERATOR last);

    /// Create a priority queue, adapting the specified `container`, having
    /// the specified `comparator` to order the priorities of elements,
    /// including those originally existed in `container`, and those
    /// inserted into the `container` from a sequence of `value_type`
    /// elements starting at the specified `first`, and ending immediately
    /// before the specified `last`.
    template <class INPUT_ITERATOR>
    priority_queue(INPUT_ITERATOR    first,
                   INPUT_ITERATOR    last,
                   const COMPARATOR& comparator,
                   const CONTAINER&  container);

    /// Create a priority queue, adapting the specified `container`, having
    /// the specified `comparator` to order elements in the priority queue,
    /// including those originally existed in `container`, and those
    /// inserted into the `container` from a sequence of `value_type`
    /// elements starting at the specified `first`, and ending immediately
    /// before the specified `last`.
    template <class INPUT_ITERATOR>
    priority_queue(
           INPUT_ITERATOR                            first,
           INPUT_ITERATOR                            last,
           const COMPARATOR&                         comparator,
           BloombergLP::bslmf::MovableRef<CONTAINER> container);

    /// Create a priority queue having the same value as the specified
    /// `original` object.  Use a copy of the comparator from `original` to
    /// order elements in the priority queue.
    priority_queue(const priority_queue& original);

    /// Create a priority queue having the same value as the specified
    /// `original` object.  Use a copy of the comparator from `original` to
    /// order elements in the priority queue.
    priority_queue(BloombergLP::bslmf::MovableRef<priority_queue> original);

    /// Create an empty priority queue, adapting a default-constructed
    /// container of the (template parameter) type `CONTAINER` that uses the
    /// specified `basicAllocator` to supply memory.  Use a
    /// default-constructed object of the (template parameter) type
    /// `COMPARATOR` to order elements in the priority queue.  Note that
    /// this constructor is only defined if the underlying container uses
    /// allocator.  Otherwise this constructor is disabled.
    template <class ALLOCATOR>
    explicit
    priority_queue(const ALLOCATOR& basicAllocator,
                   typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type * = 0);

    /// Create an empty priority queue, adapting a default-constructed
    /// container of the (template parameter) type `CONTAINER` that uses the
    /// specified `basicAllocator` to supply memory, and the specified
    /// `comparator` to order elements in the priority queue.  Note that
    /// this constructor is only defined if the underlying container uses
    /// allocator.  Otherwise this constructor is disabled.
    template <class ALLOCATOR>
    priority_queue(const COMPARATOR& comparator,
                   const ALLOCATOR&  basicAllocator,
                   typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type * = 0);

    /// Create a priority queue, adapting the specified `container` that
    /// uses the specified `basicAllocator` to supply memory, and the
    /// specified `comparator` to order elements in the priority queue.
    /// Note that this constructor is only defined if the underlying
    /// container uses allocator.  Otherwise this constructor is disabled.
    template <class ALLOCATOR>
    priority_queue(const COMPARATOR& comparator,
                   const CONTAINER&  container,
                   const ALLOCATOR&  basicAllocator,
                   typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type * = 0);

    /// Create a priority queue, adapting the specified `container` that
    /// uses the specified `basicAllocator` to supply memory, and the
    /// specified `comparator` to order elements in the priority queue.
    /// Note that this constructor is only defined if the underlying
    /// container uses allocator.  Otherwise this constructor is disabled.
    template <class ALLOCATOR>
    priority_queue(const COMPARATOR&                         comparator,
                   BloombergLP::bslmf::MovableRef<CONTAINER> container,
                   const ALLOCATOR&                          basicAllocator,
                   typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type * = 0);

    /// Create a priority queue having the same value as the specified
    /// `original` object and using the specified `basicAllocator` to supply
    /// memory.  Use a copy of the comparator from `original` to order
    /// elements in the priority queue.  Note that this constructor is only
    /// defined if the underlying container uses allocator.  Otherwise this
    /// constructor is disabled.
    template <class ALLOCATOR>
    priority_queue(const priority_queue& original,
                   const ALLOCATOR&      basicAllocator,
                   typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type * = 0);

    /// Create a priority queue having the same value as the specified
    /// `original` object and using the specified `basicAllocator` to supply
    /// memory.  Use a copy of the comparator from `original` to order
    /// elements in the priority queue.  Note that this constructor is only
    /// defined if the underlying container uses allocator.  Otherwise this
    /// constructor is disabled.
    template <class ALLOCATOR>
    priority_queue(
                 BloombergLP::bslmf::MovableRef<priority_queue> original,
                 const ALLOCATOR&                               basicAllocator,
                 typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type * = 0);

    /// Create a priority queue from the elements of the specified `range`.
    /// Optionally specify a `comparator` used to order elements in the
    /// priority queue.  Optionally supply an `allocator` to supply memory.  If
    /// `allocator` is not supplied and if `CONTAINER` is allocator aware, the
    /// currently installed default allocator is used.  Note that `range` must
    /// (minimally) meet the requirements of an input range and the values from
    /// the range must have a type matching or convertible to (template
    /// parameter) `VALUE`.  Also note that the constructor overloads that take
    /// allocators are defined only if the underlying `CONTAINTER` is allocator
    /// aware.
    template <class t_RANGE>
    BSLSTL_PRIORITY_QUEUE_REQUIRES_CONTAINER_COMPATIBLE_RANGE(t_RANGE, VALUE)
    priority_queue(
         from_range_t                               ,
         BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range,
         const COMPARATOR&                          comparator = COMPARATOR());
    template <class t_RANGE, class t_ALLOCATOR>
    BSLSTL_PRIORITY_QUEUE_REQUIRES_CONTAINER_COMPATIBLE_RANGE(t_RANGE, VALUE)
    priority_queue(from_range_t                               ,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range,
                   const COMPARATOR&                          comparator,
                   const t_ALLOCATOR&                         allocator,
                   typename enable_if<bsl::uses_allocator<CONTAINER,
                                                          t_ALLOCATOR>::value,
                                      t_ALLOCATOR>::type * = 0);
    template <class t_RANGE, class t_ALLOCATOR>
    BSLSTL_PRIORITY_QUEUE_REQUIRES_CONTAINER_COMPATIBLE_RANGE(t_RANGE, VALUE)
    priority_queue(from_range_t                               ,
                   BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range,
                   const t_ALLOCATOR&                         allocator,
                   typename enable_if<bsl::uses_allocator<CONTAINER,
                                                          t_ALLOCATOR>::value,
                                      t_ALLOCATOR>::type * = 0);

    // MANIPULATORS

    /// Assign to this object the value and comparator of the specified
    /// `rhs` object and return a reference providing modifiable access to
    /// this object.
    priority_queue& operator=(const priority_queue& rhs);

    /// Assign to this object the value and comparator of the specified
    /// `rhs` object and return a reference providing modifiable access to
    /// this object.  `rhs` is left in a valid but unspecified state.
    priority_queue& operator=(
                            BloombergLP::bslmf::MovableRef<priority_queue> rhs)
                                    BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(false);

    /// Insert the specified `value` into this priority queue.  In effect,
    /// performs `c.push_back(value);`.
    void push(const value_type& value);

    /// Insert the specified `value` into this priority queue.  In effect,
    /// performs `c.push_back(value);`.
    void push(BloombergLP::bslmf::MovableRef<value_type> value);

    /// Insert the elements of the specified `range` into this priority queue.
    /// Note that `range` must meet the requirements of an input range and the
    /// values from `range` must have a type matching or convertible to
    /// (template parameter) `VALUE`.
    template <class t_RANGE>
    BSLSTL_PRIORITY_QUEUE_REQUIRES_CONTAINER_COMPATIBLE_RANGE(t_RANGE, VALUE)
    void push_range(BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range);

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_priorityqueue.h
#ifndef BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT
#define BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A
#define BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT
#endif
#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 0
    void emplace();
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 0

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 1
    template <class Args_01>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 1

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 2
    template <class Args_01,
              class Args_02>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 2

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 3
    template <class Args_01,
              class Args_02,
              class Args_03>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 3

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 4
    template <class Args_01,
              class Args_02,
              class Args_03,
              class Args_04>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 4

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 5
    template <class Args_01,
              class Args_02,
              class Args_03,
              class Args_04,
              class Args_05>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 5

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 6
    template <class Args_01,
              class Args_02,
              class Args_03,
              class Args_04,
              class Args_05,
              class Args_06>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 6

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 7
    template <class Args_01,
              class Args_02,
              class Args_03,
              class Args_04,
              class Args_05,
              class Args_06,
              class Args_07>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 7

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 8
    template <class Args_01,
              class Args_02,
              class Args_03,
              class Args_04,
              class Args_05,
              class Args_06,
              class Args_07,
              class Args_08>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 8

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 9
    template <class Args_01,
              class Args_02,
              class Args_03,
              class Args_04,
              class Args_05,
              class Args_06,
              class Args_07,
              class Args_08,
              class Args_09>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 9

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 10
    template <class Args_01,
              class Args_02,
              class Args_03,
              class Args_04,
              class Args_05,
              class Args_06,
              class Args_07,
              class Args_08,
              class Args_09,
              class Args_10>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
                 BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10);
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_A >= 10

#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
    template <class... Args>
    void emplace(BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args);
// }}} END GENERATED CODE
#endif

    /// Remove the top element from this `priority_queue` object that has
    /// the highest priority.  In effect, performs `c.pop_back();`.  The
    /// behavior is undefined if there is currently no elements in this
    /// object.
    void pop();

    /// Efficiently exchange the value of this object with the value of the
    /// specified `other` object.  In effect, performs
    /// `using bsl::swap; swap(c, other.c);`.
    void swap(priority_queue& other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                                 bsl::is_nothrow_swappable<CONTAINER>::value &&
                                 bsl::is_nothrow_swappable<COMPARATOR>::value);

    // ACCESSORS

    /// Return `true` if this `priority_queue` object contains no elements,
    /// and `false` otherwise.  In effect, performs `return c.empty();`.
    bool empty() const;

    /// Return the number of elements in this `priority_queue` object.  In
    /// effect, performs `return c.size()`.
    size_type size() const;

    /// Return a reference providing non-modifiable access to the element
    /// having the highest priority in this `priority_queue` object.  In
    /// effect, performs `return c.front()`.  The behavior is undefined if
    /// the priority queue is empty.
    const_reference top() const;
};

#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
// CLASS TEMPLATE DEDUCTION GUIDES

/// Deduce the template parameter `VALUE` and `CONTAINER` from the
/// parameters supplied to the constructor of `priority_queue`.
template <
    class COMPARATOR,
    class CONTAINER,
    class = bsl::enable_if_t<!bsl::IsStdAllocator_v<CONTAINER>>
    >
priority_queue(COMPARATOR, CONTAINER)
  -> priority_queue<typename CONTAINER::value_type, CONTAINER, COMPARATOR>;

/// Deduce the template parameters `VALUE`, `CONTAINER` and `COMPARATOR`
/// from the parameters supplied to the constructor of `priority_queue`.
/// This deduction guide does not participate unless the supplied allocator
/// is convertible to the underlying container's `allocator_type`.
template <
    class COMPARATOR,
    class CONTAINER,
    class ALLOCATOR,
    class = bsl::enable_if_t<bsl::uses_allocator_v<CONTAINER, ALLOCATOR>>
    >
priority_queue(COMPARATOR, CONTAINER, ALLOCATOR)
  -> priority_queue<typename CONTAINER::value_type, CONTAINER, COMPARATOR>;

/// Deduce the template parameter `VALUE` from the `value_type` of the
/// iterators supplied to the constructor of `priority_queue`.
template <
    class INPUT_ITERATOR,
    class VALUE =
          typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>
    >
priority_queue(INPUT_ITERATOR, INPUT_ITERATOR)
  -> priority_queue<VALUE>;

/// Deduce the template parameter `VALUE` from the `value_type` of the
/// iterators supplied to the constructor of `priority_queue`.  Deduce the
/// template parameters `CONTAINER` and `COMPARATOR` from the other
/// parameters passed to the constructor.
template <
    class INPUT_ITERATOR,
    class COMPARATOR,
    class CONTAINER,
    class VALUE =
          typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>
    >
priority_queue(INPUT_ITERATOR, INPUT_ITERATOR, COMPARATOR, CONTAINER)
  -> priority_queue<VALUE, CONTAINER, COMPARATOR>;

#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
/// Deduce the template parameters `VALUE` and `COMPARATOR` from the parameters
/// supplied to the constructor of `priority_queue`.
template <ranges::input_range t_RANGE,
          class               t_COMPARATOR =
                                     std::less<ranges::range_value_t<t_RANGE>>,
          class               t_TYPE = ranges::range_value_t<t_RANGE>,
          class               = enable_if_t<!IsStdAllocator_v<t_COMPARATOR>>>
priority_queue(from_range_t, t_RANGE&&, t_COMPARATOR = t_COMPARATOR())
-> priority_queue<t_TYPE, vector<t_TYPE>, t_COMPARATOR>;

/// Deduce the template parameters `VALUE`, `COMPARATOR`, and `ALLOCATOR` from
/// the parameters supplied to the constructor of `priority_queue`.  This
/// deduction guide does not participate if the `t_ALLOCATOR` parameter does
/// not meet the requirements for a standard allocator or the `t_COMPARATOR`
/// parameter meets the requirements for a standard allocator.
template <ranges::input_range t_RANGE,
          class               t_COMPARATOR,
          class               t_ALLOCATOR,
          class               t_TYPE = ranges::range_value_t<t_RANGE>>
requires (!IsStdAllocator_v<t_COMPARATOR> && IsStdAllocator_v<t_ALLOCATOR>)
priority_queue(from_range_t, t_RANGE&&, t_COMPARATOR, t_ALLOCATOR)
-> priority_queue<t_TYPE, vector<t_TYPE, t_ALLOCATOR>, t_COMPARATOR>;

/// Deduce the template parameters `VALUE` and `ALLOCATOR` from the parameters
/// supplied to the constructor of `priority_queue`.  This deduction guide does
/// not participate unless the `t_ALLOCATOR` parameter meets the requirements
/// for a standard allocator.
template <ranges::input_range t_RANGE,
          class               t_ALLOCATOR,
          class               t_TYPE = ranges::range_value_t<t_RANGE>,
          class               = enable_if_t<IsStdAllocator_v<t_ALLOCATOR>>>
priority_queue(from_range_t, t_RANGE&&, t_ALLOCATOR)
-> priority_queue<t_TYPE, vector<t_TYPE, t_ALLOCATOR>>;
#endif
#endif

// FREE FUNCTIONS

/// Exchange the container and comparator of the specified `a` object with
/// the container and comparator of the specified `b` object.
template <class VALUE, class CONTAINER, class COMPARATOR>
void swap(priority_queue<VALUE, CONTAINER, COMPARATOR>& a,
          priority_queue<VALUE, CONTAINER, COMPARATOR>& b)
                                    BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(false);

// ============================================================================
//                  TEMPLATE AND INLINE FUNCTION DEFINITIONS
// ============================================================================

                         // --------------------
                         // class priority_queue
                         // --------------------

// CREATORS
template <class VALUE, class CONTAINER, class COMPARATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue()
{
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                                                  const COMPARATOR& comparator)
: comp(comparator)
{
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                                                  const COMPARATOR& comparator,
                                                  const CONTAINER&  container)
: c(container)
, comp(comparator)
{
    std::make_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                          const COMPARATOR&                         comparator,
                          BloombergLP::bslmf::MovableRef<CONTAINER> container)
: c(MoveUtil::move(container))
, comp(comparator)
{
    std::make_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class INPUT_ITERATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                                                       INPUT_ITERATOR    first,
                                                       INPUT_ITERATOR    last)
{
    c.insert(c.end(), first, last);
    std::make_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class INPUT_ITERATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                                                  INPUT_ITERATOR    first,
                                                  INPUT_ITERATOR    last,
                                                  const COMPARATOR& comparator,
                                                  const CONTAINER&  container)
: c(container)
, comp(comparator)
{
    c.insert(c.end(), first, last);
    std::make_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class INPUT_ITERATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                         INPUT_ITERATOR                             first,
                         INPUT_ITERATOR                             last,
                         const COMPARATOR&                          comparator,
                         BloombergLP::bslmf::MovableRef<CONTAINER>  container)
: c(MoveUtil::move(container))
, comp(comparator)
{
    c.insert(c.end(), first, last);
    std::make_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                                                const priority_queue& original)
: c(original.c)
, comp(original.comp)
{
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                       BloombergLP::bslmf::MovableRef<priority_queue> original)
: c(MoveUtil::move(MoveUtil::access(original).c))
, comp(MoveUtil::access(original).comp)
{
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class ALLOCATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                          const ALLOCATOR& basicAllocator,
                          typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type *)
: c(basicAllocator)
, comp(COMPARATOR())
{
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class ALLOCATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                          const COMPARATOR& comparator,
                          const ALLOCATOR&  basicAllocator,
                          typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type *)
: c(basicAllocator)
, comp(comparator)
{
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class ALLOCATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                          const COMPARATOR& comparator,
                          const CONTAINER&  container,
                          const ALLOCATOR&  basicAllocator,
                          typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type *)
: c(container, basicAllocator)
, comp(comparator)
{
    std::make_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class ALLOCATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                      const COMPARATOR&                         comparator,
                      BloombergLP::bslmf::MovableRef<CONTAINER> container,
                      const ALLOCATOR&                          basicAllocator,
                      typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type *)
: c(MoveUtil::move(container), basicAllocator)
, comp(comparator)
{
    std::make_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class ALLOCATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                          const priority_queue& original,
                          const ALLOCATOR&      basicAllocator,
                          typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type *)
: c(original.c, basicAllocator)
, comp(original.comp)
{
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class ALLOCATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                 BloombergLP::bslmf::MovableRef<priority_queue> original,
                 const ALLOCATOR&                               basicAllocator,
                 typename enable_if<
                              bsl::uses_allocator<CONTAINER, ALLOCATOR>::value,
                              ALLOCATOR>::type *)
: c(MoveUtil::move(MoveUtil::access(original).c), basicAllocator)
, comp(MoveUtil::access(original).comp)
{
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class t_RANGE>
BSLSTL_PRIORITY_QUEUE_REQUIRES_CONTAINER_COMPATIBLE_RANGE(t_RANGE, VALUE)
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                         from_range_t                               ,
                         BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range,
                         const COMPARATOR&                          comparator)
#ifdef BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_TO_CONTAINER
: c(ranges::to<CONTAINER>(std::forward<t_RANGE>(range)))
#else
: c(from_range, BSLS_COMPILERFEATURES_FORWARD(t_RANGE, range))
#endif
, comp(comparator)
{
    std::make_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class t_RANGE, class t_ALLOCATOR>
BSLSTL_PRIORITY_QUEUE_REQUIRES_CONTAINER_COMPATIBLE_RANGE(t_RANGE, VALUE)
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                    from_range_t                               ,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range,
                    const COMPARATOR&                          comparator,
                    const t_ALLOCATOR&                         allocator,
                    typename enable_if<bsl::uses_allocator<CONTAINER,
                                                           t_ALLOCATOR>::value,
                                       t_ALLOCATOR>::type *)
#ifdef BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_TO_CONTAINER
: c(ranges::to<CONTAINER>(std::forward<t_RANGE>(range), allocator))
#else
: c(from_range, BSLS_COMPILERFEATURES_FORWARD(t_RANGE, range), allocator)
#endif
, comp(comparator)
{
    std::make_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class t_RANGE, class t_ALLOCATOR>
BSLSTL_PRIORITY_QUEUE_REQUIRES_CONTAINER_COMPATIBLE_RANGE(t_RANGE, VALUE)
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>::priority_queue(
                    from_range_t                               ,
                    BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range,
                    const t_ALLOCATOR&                         allocator,
                    typename enable_if<bsl::uses_allocator<CONTAINER,
                                                           t_ALLOCATOR>::value,
                                       t_ALLOCATOR>::type *)
#ifdef BSLS_LIBRARYFEATURES_HAS_CPP23_RANGES_TO_CONTAINER
: c(ranges::to<CONTAINER>(std::forward<t_RANGE>(range), allocator))
#else
: c(from_range, BSLS_COMPILERFEATURES_FORWARD(t_RANGE, range), allocator)
#endif
{
    std::make_heap(c.begin(), c.end(), comp);
}

// PRIVATE MANIPULATORS
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class INPUT_ITER, class SENTINEL>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::privatePushRange(
                                                              INPUT_ITER first,
                                                              SENTINEL   last)
{
    while (first != last) {
        c.push_back(*first);
        ++first;
    }
}

// MANIPULATORS
template <class VALUE, class CONTAINER, class COMPARATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>&
priority_queue<VALUE, CONTAINER, COMPARATOR>::operator=(
                                                     const priority_queue& rhs)
{
    c = rhs.c;
    comp = rhs.comp;
    return *this;
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
priority_queue<VALUE, CONTAINER, COMPARATOR>&
priority_queue<VALUE, CONTAINER, COMPARATOR>::operator=(
                            BloombergLP::bslmf::MovableRef<priority_queue> rhs)
                                     BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(false)
{
    c = MoveUtil::move(MoveUtil::access(rhs).c);
    comp = MoveUtil::access(rhs).comp;
    return *this;
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::push(
                                                       const value_type& value)
{
    c.push_back(value);
    std::push_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::push(
                              BloombergLP::bslmf::MovableRef<value_type> value)
{
    c.push_back(MoveUtil::move(value));
    std::push_heap(c.begin(), c.end(), comp);
}

template <class VALUE, class CONTAINER, class COMPARATOR>
template <class t_RANGE>
BSLSTL_PRIORITY_QUEUE_REQUIRES_CONTAINER_COMPATIBLE_RANGE(t_RANGE, VALUE)
void priority_queue<VALUE, CONTAINER, COMPARATOR>::push_range(
                              BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range)
{
#if defined(BSLS_LIBRARYFEATURES_HAS_CPP20_CONCEPTS) \
 && defined(BSLS_LIBRARYFEATURES_HAS_CPP20_RANGES)
    if constexpr (requires{ c.append_range(std::forward<t_RANGE>(range)); }) {
        c.append_range(std::forward<t_RANGE>(range));
    }
    else {
        ranges::copy(range, back_inserter(c));
    }
#else
    privatePushRange(bsl::begin(range), bsl::end(range));
#endif
    std::make_heap(c.begin(), c.end(), comp);
}

#if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES
// {{{ BEGIN GENERATED CODE
// Command line: sim_cpp11_features.pl bslstl_priorityqueue.h
#ifndef BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT
#define BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT 10
#endif
#ifndef BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B
#define BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT
#endif
#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 0
template <class VALUE, class CONTAINER, class COMPARATOR>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                               )
{
    c.emplace_back();
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 0

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 1
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 1

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 2
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01,
          class Args_02>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
                   BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 2

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 3
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01,
          class Args_02,
          class Args_03>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
                   BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
                   BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 3

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 4
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01,
          class Args_02,
          class Args_03,
          class Args_04>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
                   BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
                   BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
                   BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 4

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 5
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01,
          class Args_02,
          class Args_03,
          class Args_04,
          class Args_05>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
                   BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
                   BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
                   BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
                   BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 5

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 6
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01,
          class Args_02,
          class Args_03,
          class Args_04,
          class Args_05,
          class Args_06>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
                   BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
                   BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
                   BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
                   BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
                   BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 6

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 7
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01,
          class Args_02,
          class Args_03,
          class Args_04,
          class Args_05,
          class Args_06,
          class Args_07>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
                   BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
                   BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
                   BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
                   BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
                   BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06),
                   BSLS_COMPILERFEATURES_FORWARD(Args_07,args_07));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 7

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 8
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01,
          class Args_02,
          class Args_03,
          class Args_04,
          class Args_05,
          class Args_06,
          class Args_07,
          class Args_08>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
                   BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
                   BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
                   BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
                   BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
                   BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06),
                   BSLS_COMPILERFEATURES_FORWARD(Args_07,args_07),
                   BSLS_COMPILERFEATURES_FORWARD(Args_08,args_08));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 8

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 9
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01,
          class Args_02,
          class Args_03,
          class Args_04,
          class Args_05,
          class Args_06,
          class Args_07,
          class Args_08,
          class Args_09>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
                   BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
                   BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
                   BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
                   BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
                   BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06),
                   BSLS_COMPILERFEATURES_FORWARD(Args_07,args_07),
                   BSLS_COMPILERFEATURES_FORWARD(Args_08,args_08),
                   BSLS_COMPILERFEATURES_FORWARD(Args_09,args_09));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 9

#if BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 10
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class Args_01,
          class Args_02,
          class Args_03,
          class Args_04,
          class Args_05,
          class Args_06,
          class Args_07,
          class Args_08,
          class Args_09,
          class Args_10>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_01) args_01,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_02) args_02,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_03) args_03,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_04) args_04,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_05) args_05,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_06) args_06,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_07) args_07,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_08) args_08,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_09) args_09,
                            BSLS_COMPILERFEATURES_FORWARD_REF(Args_10) args_10)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args_01,args_01),
                   BSLS_COMPILERFEATURES_FORWARD(Args_02,args_02),
                   BSLS_COMPILERFEATURES_FORWARD(Args_03,args_03),
                   BSLS_COMPILERFEATURES_FORWARD(Args_04,args_04),
                   BSLS_COMPILERFEATURES_FORWARD(Args_05,args_05),
                   BSLS_COMPILERFEATURES_FORWARD(Args_06,args_06),
                   BSLS_COMPILERFEATURES_FORWARD(Args_07,args_07),
                   BSLS_COMPILERFEATURES_FORWARD(Args_08,args_08),
                   BSLS_COMPILERFEATURES_FORWARD(Args_09,args_09),
                   BSLS_COMPILERFEATURES_FORWARD(Args_10,args_10));
    std::push_heap(c.begin(), c.end(), comp);
}
#endif  // BSLSTL_PRIORITYQUEUE_VARIADIC_LIMIT_B >= 10

#else
// The generated code below is a workaround for the absence of perfect
// forwarding in some compilers.
template <class VALUE, class CONTAINER, class COMPARATOR>
template <class... Args>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::emplace(
                               BSLS_COMPILERFEATURES_FORWARD_REF(Args)... args)
{
    c.emplace_back(BSLS_COMPILERFEATURES_FORWARD(Args,args)...);
    std::push_heap(c.begin(), c.end(), comp);
}
// }}} END GENERATED CODE
#endif

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::pop()
{
    std::pop_heap(c.begin(), c.end(), comp);
    c.pop_back();
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
void priority_queue<VALUE, CONTAINER, COMPARATOR>::swap(priority_queue& other)
    BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(
                                 bsl::is_nothrow_swappable<CONTAINER>::value &&
                                 bsl::is_nothrow_swappable<COMPARATOR>::value)
{
    BloombergLP::bslalg::SwapUtil::swap(&c, &other.c);
    BloombergLP::bslalg::SwapUtil::swap(&comp, &other.comp);
}

// ACCESSORS
template <class VALUE, class CONTAINER, class COMPARATOR>
inline
bool priority_queue<VALUE, CONTAINER, COMPARATOR>::empty() const
{
    return c.empty();
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
typename priority_queue<VALUE, CONTAINER, COMPARATOR>::size_type
priority_queue<VALUE, CONTAINER, COMPARATOR>::size() const
{
    return c.size();
}

template <class VALUE, class CONTAINER, class COMPARATOR>
inline
typename priority_queue<VALUE, CONTAINER, COMPARATOR>::const_reference
priority_queue<VALUE, CONTAINER, COMPARATOR>::top() const
{
    return c.front();
}

// FREE FUNCTIONS
template <class VALUE, class CONTAINER, class COMPARATOR>
void swap(priority_queue<VALUE, CONTAINER, COMPARATOR>& a,
          priority_queue<VALUE, CONTAINER, COMPARATOR>& b)
                                     BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(false)
{
    a.swap(b);
}

}  // close namespace bsl

#else // if ! defined(DEFINED_BSLSTL_PRIORITYQUEUE_H)
# error Not valid except when included from bslstl_priorityqueue.h
#endif // ! defined(COMPILING_BSLSTL_PRIORITYQUEUE_H)

#endif // ! defined(INCLUDED_BSLSTL_PRIORITYQUEUE_CPP03)

// ----------------------------------------------------------------------------
// Copyright 2016 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------
