Files
cppdraft_translate/cppdraft/priqueue/cons.md
2025-10-25 03:02:53 +03:00

92 lines
3.5 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[priqueue.cons]
# 23 Containers library [[containers]](./#containers)
## 23.6 Container adaptors [[container.adaptors]](container.adaptors#priqueue.cons)
### 23.6.4 Class template priority_queue [[priority.queue]](priority.queue#priqueue.cons)
#### 23.6.4.2 Constructors [priqueue.cons]
[🔗](#lib:priority_queue,constructor)
`constexpr priority_queue(const Compare& x, const Container& y);
constexpr priority_queue(const Compare& x, Container&& y);
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16141)
*Preconditions*: x defines a strict weak ordering ([[alg.sorting]](alg.sorting "26.8Sorting and related operations"))[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16145)
*Effects*: Initializescomp withx andc withy (copy constructing or move constructing as appropriate);
callsmake_heap(c.begin(), c.end(), comp)[.](#2.sentence-1)
[🔗](#lib:priority_queue,constructor_)
`template<class InputIterator>
constexpr priority_queue(InputIterator first, InputIterator last, const Compare& x = Compare());
`
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16163)
*Preconditions*: x defines a strict weak ordering ([[alg.sorting]](alg.sorting "26.8Sorting and related operations"))[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16167)
*Effects*: Initializes c withfirst as the first argument andlast as the second argument, and
initializes comp with x;
then calls make_heap(c.begin(), c.end(), comp)[.](#4.sentence-1)
[🔗](#lib:priority_queue,constructor__)
`template<class InputIterator>
constexpr priority_queue(InputIterator first, InputIterator last, const Compare& x,
const Container& y);
template<class InputIterator>
constexpr priority_queue(InputIterator first, InputIterator last, const Compare& x,
Container&& y);
`
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16187)
*Preconditions*: x defines a strict weak ordering ([[alg.sorting]](alg.sorting "26.8Sorting and related operations"))[.](#5.sentence-1)
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16191)
*Effects*: Initializescomp withx andc withy (copy constructing or move constructing as appropriate);
callsc.insert(c.end(), first, last);
and finally callsmake_heap(c.begin(), c.end(), comp)[.](#6.sentence-1)
[🔗](#lib:priority_queue,constructor___)
`template<[container-compatible-range](container.intro.reqmts#concept:container-compatible-range "23.2.2.1Introduction[container.intro.reqmts]")<T> R>
constexpr priority_queue(from_range_t, R&& rg, const Compare& x = Compare());
`
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16211)
*Preconditions*: x defines a strict weak ordering ([[alg.sorting]](alg.sorting "26.8Sorting and related operations"))[.](#7.sentence-1)
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/containers.tex#L16215)
*Effects*: Initializes comp with x andc with ranges::to<Container>(std::forward<R>(rg)) and
finally calls make_heap(c.begin(), c.end(), comp)[.](#8.sentence-1)