std::priority_queue::priority_queue
De 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) | (avant C++11) (depuis C++11) |
explicit priority_queue( const Compare& compare = Compare(), Container&& cont = Container()); |
(2) | (depuis C++11) |
priority_queue( const priority_queue& other ); |
(3) | |
priority_queue( priority_queue&& other ); |
(4) | (depuis C++11) |
template< class Alloc > explicit priority_queue( const Alloc& alloc ); |
(5) | (depuis C++11) |
template< class Alloc > priority_queue( const Compare& compare, const Alloc& alloc ); |
(6) | (depuis C++11) |
template< class Alloc > priority_queue( const Compare& compare, const Container& cont, const Alloc& alloc ); |
(7) | (depuis C++11) |
template< class Alloc > priority_queue( const Compare& compare, Container&& cont, const Alloc& alloc ); |
(8) | (depuis C++11) |
template< class Alloc > priority_queue( const priority_queue& other, const Alloc& alloc ); |
(9) | (depuis C++11) |
template< class Alloc > priority_queue( priority_queue&& other, const Alloc& alloc ); |
(10) | (depuis C++11) |
template< class InputIt > priority_queue( InputIt first, InputIt last, const Compare& compare, const Container& cont ); |
(11) | (depuis C++11) |
template< class InputIt > priority_queue(InputIt first, InputIt last, const Compare& compare = Compare(), Container&& cont = Container()); |
(12) | (depuis C++11) |
Construit nouveau conteneur sous-jacent de l'adaptateur de réservoir à partir d'une variété de sources de données .
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)
Copie-construit le récipient sous-jacent
C'est aussi le (avant C++11) constructeur par défaut|Copy-constructs the underlying container c avec le contenu de cont. Copie-construit le comp foncteur comparaison avec le contenu de compare. Appels 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 (avant C++11)}}2)
Déplacez-construit le conteneur sous-jacent
c avec std::move(cont). Déplacez-construit le foncteur de comparaison avec comp std::move(compare). Appels std::make_heap(c.begin(), c.end(), comp). C'est aussi le (depuis C++11) constructeur par défautOriginal:
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 (depuis 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)
Copiez constructeur. L'adaptateur est construit avec la copie du contenu de
other.c. Le foncteur de comparaison est construit avec std::move(other.comp). (implicitement déclaré)Original:
Copy constructor. The adaptor is copy-constructed with the contents of
other.c. The comparison functor is constructed with std::move(other.comp). (implicitement déclaré)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)
Déplacez constructeur. L'adaptateur est construit avec foncteur de comparaison
std::move(other.c).The est construit avec std::move(other.comp). (implicitement déclaré)Original:
Move constructor. The adaptor is constructed with
std::move(other.c).The comparison functor is constructed with std::move(other.comp). (implicitement déclaré)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)
Les constructeurs suivants ne sont définies que si
std::uses_allocator<container_type, Alloc>::value == true, qui est, si le conteneur sous-jacent est un conteneur d'allocation-aware (valable pour tous les conteneurs de la bibliothèque standard) .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)
Construit le conteneur sous-jacent à l'aide
alloc comme allocateur. Appelle effectivement 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)
Construit le conteneur sous-jacent à l'aide
alloc comme allocateur. Appelle effectivement c(alloc). Copier-constructions comp de 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)
Construit le récipient sous-jacent sur le contenu de
cont et en utilisant comme alloc allocateur. Appelle effectivement c(cont, alloc). Copier-constructions comp de 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)
Construit le récipient sous-jacent sur le contenu de
cont utilisant une sémantique de déplacement tout en utilisant comme alloc allocateur. Appelle effectivement c(std::move(cont), alloc). Copier-constructions comp de 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)
Construit l'adaptateur avec le contenu de
other.c et en utilisant comme alloc allocateur. Appelle effectivement c(athor.c, alloc). Copier-constructions comp de 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)
Construit l'adaptateur avec le contenu de
other utilisant une sémantique de déplacement tout en utilisant comme alloc allocateur. Appelle effectivement c(std::move(other.c), alloc). Déplacez-constructions comp de 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)
Copier-constructions
c de cont et comp de compare. Appelle ensuite c.insert(c.end(), first, last);, puis appelle 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)
Déplacez-constructions
c de std::move(cont) et comp de std::move(compare). Appelle ensuite c.insert(c.end(), first, last);, puis appelle 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.
Paramètres
| alloc | - | allocateur à utiliser pour toutes les allocations de mémoire du conteneur sous-jacent
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 | - | un autre adaptateur de réservoir à être utilisé en tant que source pour initialiser le conteneur sous-jacent
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 | - | Récipient pour être utilisé comme source pour initialiser le conteneur sous-jacent
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 | - | l'objet fonction de comparaison pour initialiser le foncteur de comparaison sous-jacente
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 | - | éventail d'éléments à initialiser avec
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.
| ||
Complexité
1, 3, 5, 6, 8: linéaire ou
cont 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: constante
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 |
Exemple
#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';
}
Résultat :
1
1
5
Voir aussi
| Attribue les valeurs dans l'adaptateur de conteneur (fonction membre publique) | |