8#ifndef INCLUDED_BSLSTL_PRIORITYQUEUE
9#define INCLUDED_BSLSTL_PRIORITYQUEUE
375#include <bslscm_version.h>
403#if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
407# define COMPILING_BSLSTL_PRIORITYQUEUE_H
409# undef COMPILING_BSLSTL_PRIORITYQUEUE_H
427template <
class VALUE,
428 class CONTAINER = vector<VALUE>,
429 class COMPARATOR = std::less<typename CONTAINER::value_type> >
432#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
442 typedef BloombergLP::bslmf::MovableRefUtil MoveUtil;
467 BloombergLP::bslma::UsesBslmaAllocator,
468 BloombergLP::bslma::UsesBslmaAllocator<container_type>::value);
488 priority_queue(
const COMPARATOR& comparator,
const CONTAINER& container);
495 const COMPARATOR& comparator,
496 BloombergLP::bslmf::MovableRef<CONTAINER> container);
505 template <
class INPUT_ITERATOR>
514 template <
class INPUT_ITERATOR>
517 const COMPARATOR& comparator,
518 const CONTAINER& container);
526 template <
class INPUT_ITERATOR>
528 INPUT_ITERATOR first,
530 const COMPARATOR& comparator,
531 BloombergLP::bslmf::MovableRef<CONTAINER> container);
541 priority_queue(BloombergLP::bslmf::MovableRef<priority_queue> original);
550 template <
class ALLOCATOR>
555 ALLOCATOR>::type * = 0);
563 template <
class ALLOCATOR>
565 const ALLOCATOR& basicAllocator,
568 ALLOCATOR>::type * = 0);
575 template <
class ALLOCATOR>
577 const CONTAINER& container,
578 const ALLOCATOR& basicAllocator,
581 ALLOCATOR>::type * = 0);
588 template <
class ALLOCATOR>
590 BloombergLP::bslmf::MovableRef<CONTAINER> container,
591 const ALLOCATOR& basicAllocator,
594 ALLOCATOR>::type * = 0);
602 template <
class ALLOCATOR>
604 const ALLOCATOR& basicAllocator,
607 ALLOCATOR>::type * = 0);
615 template <
class ALLOCATOR>
617 BloombergLP::bslmf::MovableRef<priority_queue> original,
618 const ALLOCATOR& basicAllocator,
621 ALLOCATOR>::type * = 0);
634 BloombergLP::bslmf::MovableRef<priority_queue> rhs)
643 void push(BloombergLP::bslmf::MovableRef<value_type> value);
645#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
650 template <
class... Args>
661 bsl::is_nothrow_swappable<CONTAINER>::value &&
662 bsl::is_nothrow_swappable<COMPARATOR>::value);
684#ifdef BSLS_COMPILERFEATURES_SUPPORT_CTAD
692 class = bsl::enable_if_t<!bsl::IsStdAllocator_v<CONTAINER>>
705 class = bsl::enable_if_t<bsl::uses_allocator_v<CONTAINER, ALLOCATOR>>
713 class INPUT_ITERATOR,
715 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>
725 class INPUT_ITERATOR,
729 typename BloombergLP::bslstl::IteratorUtil::IterVal_t<INPUT_ITERATOR>
731priority_queue(INPUT_ITERATOR, INPUT_ITERATOR, COMPARATOR, CONTAINER)
739template <
class VALUE,
class CONTAINER,
class COMPARATOR>
753template <
class VALUE,
class CONTAINER,
class COMPARATOR>
759template <
class VALUE,
class CONTAINER,
class COMPARATOR>
762 const COMPARATOR& comparator)
767template <
class VALUE,
class CONTAINER,
class COMPARATOR>
770 const COMPARATOR& comparator,
771 const CONTAINER& container)
775 std::make_heap(
c.begin(),
c.end(),
comp);
778template <
class VALUE,
class CONTAINER,
class COMPARATOR>
781 const COMPARATOR& comparator,
782 BloombergLP::bslmf::MovableRef<CONTAINER> container)
783: c(MoveUtil::move(container))
786 std::make_heap(
c.begin(),
c.end(),
comp);
789template <
class VALUE,
class CONTAINER,
class COMPARATOR>
790template <
class INPUT_ITERATOR>
793 INPUT_ITERATOR first,
796 c.insert(c.end(), first, last);
797 std::make_heap(c.begin(), c.end(), comp);
800template <
class VALUE,
class CONTAINER,
class COMPARATOR>
801template <
class INPUT_ITERATOR>
804 INPUT_ITERATOR first,
806 const COMPARATOR& comparator,
807 const CONTAINER& container)
811 c.insert(
c.end(), first, last);
812 std::make_heap(
c.begin(),
c.end(),
comp);
815template <
class VALUE,
class CONTAINER,
class COMPARATOR>
816template <
class INPUT_ITERATOR>
819 INPUT_ITERATOR first,
821 const COMPARATOR& comparator,
822 BloombergLP::bslmf::MovableRef<CONTAINER> container)
823: c(MoveUtil::move(container))
826 c.insert(
c.end(), first, last);
827 std::make_heap(
c.begin(),
c.end(),
comp);
830template <
class VALUE,
class CONTAINER,
class COMPARATOR>
839template <
class VALUE,
class CONTAINER,
class COMPARATOR>
842 BloombergLP::bslmf::MovableRef<priority_queue> original)
843: c(MoveUtil::move(MoveUtil::access(original).c))
844, comp(MoveUtil::access(original).comp)
848template <
class VALUE,
class CONTAINER,
class COMPARATOR>
849template <
class ALLOCATOR>
852 const ALLOCATOR& basicAllocator,
861template <
class VALUE,
class CONTAINER,
class COMPARATOR>
862template <
class ALLOCATOR>
865 const COMPARATOR& comparator,
866 const ALLOCATOR& basicAllocator,
875template <
class VALUE,
class CONTAINER,
class COMPARATOR>
876template <
class ALLOCATOR>
879 const COMPARATOR& comparator,
880 const CONTAINER& container,
881 const ALLOCATOR& basicAllocator,
885: c(container, basicAllocator)
888 std::make_heap(
c.begin(),
c.end(),
comp);
891template <
class VALUE,
class CONTAINER,
class COMPARATOR>
892template <
class ALLOCATOR>
895 const COMPARATOR& comparator,
896 BloombergLP::bslmf::MovableRef<CONTAINER> container,
897 const ALLOCATOR& basicAllocator,
901: c(MoveUtil::move(container), basicAllocator)
904 std::make_heap(
c.begin(),
c.end(),
comp);
907template <
class VALUE,
class CONTAINER,
class COMPARATOR>
908template <
class ALLOCATOR>
912 const ALLOCATOR& basicAllocator,
916: c(original.c, basicAllocator)
921template <
class VALUE,
class CONTAINER,
class COMPARATOR>
922template <
class ALLOCATOR>
925 BloombergLP::bslmf::MovableRef<priority_queue> original,
926 const ALLOCATOR& basicAllocator,
930: c(MoveUtil::move(MoveUtil::access(original).c), basicAllocator)
931, comp(MoveUtil::access(original).comp)
936template <
class VALUE,
class CONTAINER,
class COMPARATOR>
947template <
class VALUE,
class CONTAINER,
class COMPARATOR>
951 BloombergLP::bslmf::MovableRef<priority_queue> rhs)
954 c = MoveUtil::move(MoveUtil::access(rhs).c);
955 comp = MoveUtil::access(rhs).comp;
959template <
class VALUE,
class CONTAINER,
class COMPARATOR>
965 std::push_heap(c.begin(), c.end(), comp);
968template <
class VALUE,
class CONTAINER,
class COMPARATOR>
971 BloombergLP::bslmf::MovableRef<value_type> value)
973 c.push_back(MoveUtil::move(value));
974 std::push_heap(c.begin(), c.end(), comp);
977#if !BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES
978template <
class VALUE,
class CONTAINER,
class COMPARATOR>
979template <
class... Args>
984 std::push_heap(c.begin(), c.end(), comp);
988template <
class VALUE,
class CONTAINER,
class COMPARATOR>
992 std::pop_heap(c.begin(), c.end(), comp);
996template <
class VALUE,
class CONTAINER,
class COMPARATOR>
1000 bsl::is_nothrow_swappable<CONTAINER>::value &&
1001 bsl::is_nothrow_swappable<COMPARATOR>::value)
1003 BloombergLP::bslalg::SwapUtil::swap(&c, &other.c);
1004 BloombergLP::bslalg::SwapUtil::swap(&comp, &other.comp);
1008template <
class VALUE,
class CONTAINER,
class COMPARATOR>
1015template <
class VALUE,
class CONTAINER,
class COMPARATOR>
1023template <
class VALUE,
class CONTAINER,
class COMPARATOR>
1032template <
class VALUE,
class CONTAINER,
class COMPARATOR>
Definition bslstl_priorityqueue.h:430
size_type size() const
Definition bslstl_priorityqueue.h:1018
void emplace(Args &&... args)
Definition bslstl_priorityqueue.h:981
void pop()
Definition bslstl_priorityqueue.h:990
void swap(priority_queue &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl bool empty() const
Definition bslstl_priorityqueue.h:671
COMPARATOR value_compare
Definition bslstl_priorityqueue.h:447
CONTAINER::reference reference
Definition bslstl_priorityqueue.h:449
COMPARATOR comp
Definition bslstl_priorityqueue.h:459
CONTAINER::size_type size_type
Definition bslstl_priorityqueue.h:451
priority_queue()
Definition bslstl_priorityqueue.h:755
CONTAINER::const_reference const_reference
Definition bslstl_priorityqueue.h:450
BSLMF_NESTED_TRAIT_DECLARATION_IF(priority_queue, BloombergLP::bslma::UsesBslmaAllocator, BloombergLP::bslma::UsesBslmaAllocator< container_type >::value)
CONTAINER c
Definition bslstl_priorityqueue.h:455
CONTAINER::value_type value_type
Definition bslstl_priorityqueue.h:448
void push(const value_type &value)
Definition bslstl_priorityqueue.h:961
const_reference top() const
Definition bslstl_priorityqueue.h:1026
CONTAINER container_type
Definition bslstl_priorityqueue.h:446
priority_queue & operator=(const priority_queue &rhs)
Definition bslstl_priorityqueue.h:939
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:229
#define BSLS_COMPILERFEATURES_FORWARD(T, V)
Definition bsls_compilerfeatures.h:2018
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(...)
Definition bsls_keyword.h:634
Definition bdlb_printmethods.h:283
Definition bslmf_enableif.h:525
Definition bslmf_issame.h:146
Definition bslmf_usesallocator.h:165