std::priority_queue::priority_queue
Aus cppreference.com
[] |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> explicit priority_queue( const Compare& compare = Compare(), const Container& cont = Container()); priority_queue( const Compare& compare, const Container& cont); |
(1) | (bis C + +11) (seit C++11) |
explicit priority_queue( const Compare& compare = Compare(), Container&& cont = Container()); |
(2) | (seit C++11) |
priority_queue( const priority_queue& other ); |
(3) | |
priority_queue( priority_queue&& other ); |
(4) | (seit C++11) |
template< class Alloc > explicit priority_queue( const Alloc& alloc ); |
(5) | (seit C++11) |
template< class Alloc > priority_queue( const Compare& compare, const Alloc& alloc ); |
(6) | (seit C++11) |
template< class Alloc > priority_queue( const Compare& compare, const Container& cont, const Alloc& alloc ); |
(7) | (seit C++11) |
template< class Alloc > priority_queue( const Compare& compare, Container&& cont, const Alloc& alloc ); |
(8) | (seit C++11) |
template< class Alloc > priority_queue( const priority_queue& other, const Alloc& alloc ); |
(9) | (seit C++11) |
template< class Alloc > priority_queue( priority_queue&& other, const Alloc& alloc ); |
(10) | (seit C++11) |
template< class InputIt > priority_queue( InputIt first, InputIt last, const Compare& compare, const Container& cont ); |
(11) | (seit C++11) |
template< class InputIt > priority_queue(InputIt first, InputIt last, const Compare& compare = Compare(), Container&& cont = Container()); |
(12) | (seit C++11) |
Konstrukte neue darunterliegenden Behlter des Behlters Adapter aus einer Vielzahl von Datenquellen .
Original:
Constructs new underlying container of the container adaptor from a variety of data sources.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
1)
Kopiergeschtzte konstruiert den darunterliegenden Behlter
Dies ist auch die Default-Konstruktor (bis C + +11)|Copy-constructs the underlying container c mit dem Inhalt cont. Kopiergeschtzte konstruiert den Vergleich Funktor comp mit dem Inhalt compare. Ruft std::make_heap(c.begin(), c.end(), comp).Original:
{{{2}}}
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
c with the contents of cont. Copy-constructs the comparison functor comp with the contents of compare. Calls std::make_heap(c.begin(), c.end(), comp).}} This is also the default constructor (bis C + +11)}}2)
Move-baut der zugrunde liegenden Container
c mit std::move(cont). Move-Konstrukte der Vergleich Funktor comp mit std::move(compare). Ruft std::make_heap(c.begin(), c.end(), comp). Dies ist auch die Default-Konstruktor (seit C++11)Original:
Move-constructs the underlying container
c with std::move(cont). Move-constructs the comparison functor comp with std::move(compare). Calls std::make_heap(c.begin(), c.end(), comp). This is also the default constructor (seit C++11)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
3)
Kopieren Konstruktor. Der Adapter ist mit dem Inhalt des
other.c kopiergeschtzten konstruiert. Der Vergleich Funktor mit std::move(other.comp) gebaut. (implizit deklariert)Original:
Copy constructor. The adaptor is copy-constructed with the contents of
other.c. The comparison functor is constructed with std::move(other.comp). (implizit deklariert)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
4)
Bewegen Konstruktor. Der Adapter ist mit
std::move(other.c).The Vergleich Funktor mit std::move(other.comp) aufgebaut ist. (implizit deklariert)Original:
Move constructor. The adaptor is constructed with
std::move(other.c).The comparison functor is constructed with std::move(other.comp). (implizit deklariert)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
5-10)
Die folgenden Konstruktoren nur wenn
std::uses_allocator<container_type, Alloc>::value == true, das heit wenn der Basiswert Behlter eine Zuordner-fhigen Behlter (gilt fr alle Standard-Bibliothek Behltern) ist definiert .Original:
The following constructors are only defined if
std::uses_allocator<container_type, Alloc>::value == true, that is, if the underlying container is an allocator-aware container (true for all standard library containers).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
5)
Konstruiert den zugrunde liegenden Container mit
alloc als Allocator. Effektiv nennt c(alloc). comp is value-initialized.Original:
Constructs the underlying container using
alloc as allocator. Effectively calls c(alloc). comp is value-initialized.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
6)
Konstruiert den zugrunde liegenden Container mit
alloc als Allocator. Effektiv nennt c(alloc). Copy-Konstrukte comp von compare .Original:
Constructs the underlying container using
alloc as allocator. Effectively calls c(alloc). Copy-constructs comp from compare.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
7)
Konstruiert den darunterliegenden Behlter mit dem Inhalt und die Verwendung
cont alloc als Zuordner. Effektiv nennt c(cont, alloc). Copy-Konstrukte comp von compare .Original:
Constructs the underlying container with the contents of
cont and using alloc as allocator. Effectively calls c(cont, alloc). Copy-constructs comp from compare.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
8)
Konstruiert den darunterliegenden Behlter mit dem Inhalt unter Verwendung
cont bewegen Semantik unter Ausnutzung alloc als Zuordner. Effektiv nennt c(std::move(cont), alloc). Copy-Konstrukte comp von compare .Original:
Constructs the underlying container with the contents of
cont using move semantics while utilising alloc as allocator. Effectively calls c(std::move(cont), alloc). Copy-constructs comp from compare.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
9)
Konstrukte den Adapter mit dem Inhalt und die Verwendung
other.c alloc als Zuordner. Effektiv nennt c(athor.c, alloc). Copy-Konstrukte comp von other.comp .Original:
Constructs the adaptor with the contents of
other.c and using alloc as allocator. Effectively calls c(athor.c, alloc). Copy-constructs comp from other.comp.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
10)
Konstruiert den Adapter mit dem Inhalt der
other mit move-Semantik unter Ausnutzung alloc als Allocator. Effektiv nennt c(std::move(other.c), alloc). Move-Konstrukte comp von other.comp .Original:
Constructs the adaptor with the contents of
other using move semantics while utilising alloc as allocator. Effectively calls c(std::move(other.c), alloc). Move-constructs comp from other.comp.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
11)
Copy-Konstrukte
c von cont und comp von compare. Dann ruft c.insert(c.end(), first, last); und ruft dann std::make_heap(c.begin(), c.end(), comp); .Original:
Copy-constructs
c from cont and comp from compare. Then calls c.insert(c.end(), first, last);, and then calls std::make_heap(c.begin(), c.end(), comp);.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
12)
Move-Konstrukte
c von std::move(cont) und comp von std::move(compare). Dann ruft c.insert(c.end(), first, last); und ruft dann std::make_heap(c.begin(), c.end(), comp); .Original:
Move-constructs
c from std::move(cont) and comp from std::move(compare). Then calls c.insert(c.end(), first, last);, and then calls std::make_heap(c.begin(), c.end(), comp);.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Parameter
| alloc | - | allocator fr alle Speicherzuordnungen des zugrunde liegenden Behlter
Original: allocator to use for all memory allocations of the underlying container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| other | - | ein weiterer Container Adapter als Quelle, um den darunter liegenden Behlter zu initialisieren verwendet werden
Original: another container adaptor to be used as source to initialize the underlying container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| cont | - | Behlter zu der als Quelle fr die darunterliegenden Behlter zu initialisieren verwendet werden
Original: container to be used as source to initialize the underlying container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| compare | - | der Vergleich Funktions-Objekt zu initialisieren die zugrunde liegende Vergleich Funktor
Original: the comparison function object to initialize the underlying comparison functor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| first, last | - | Bereich von Elementen mit initialisieren
Original: range of elements to initialize with The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| Type requirements | ||
-Alloc must meet the requirements of Allocator.
| ||
-Container must meet the requirements of Container. The constructors (5-10) are only defined if Container meets the requirements of AllocatorAwareContainer
| ||
-InputIt must meet the requirements of InputIterator.
| ||
Komplexitt
1, 3, 5, 6, 8: linear in
cont oder otherOriginal:
1, 3, 5, 6, 8: linear in
cont or otherThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2, 4, 7, 9: Konstante
Original:
2, 4, 7, 9: constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| This section is incomplete |
Beispiel
#include <queue>
#include <deque>
#include <iostream>
int main()
{
std::priority_queue<int> c1;
c1.push(5);
std::cout << c1.size() << '\n';
std::priority_queue<int> c2(c1);
std::cout << c2.size() << '\n';
std::deque<int> deq {3, 1, 4, 1, 5};
std::priority_queue<int> c3(std::less<int>(), deq);
std::cout << c3.size() << '\n';
}
Output:
1
1
5
Siehe auch
weist Werte auf den Behlter-Adapter Original: assigns values to the container adaptor The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (ffentliche Elementfunktion) | |