std::priority_queue::priority_queue
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody> explicit priority_queue( const Compare& compare = Compare(), const Container& cont = Container()); priority_queue( const Compare& compare, const Container& cont); |
(1) | (fino al c++11) (dal C++11) |
explicit priority_queue( const Compare& compare = Compare(), Container&& cont = Container()); |
(2) | (dal C++11) |
priority_queue( const priority_queue& other ); |
(3) | |
priority_queue( priority_queue&& other ); |
(4) | (dal C++11) |
template< class Alloc > explicit priority_queue( const Alloc& alloc ); |
(5) | (dal C++11) |
template< class Alloc > priority_queue( const Compare& compare, const Alloc& alloc ); |
(6) | (dal C++11) |
template< class Alloc > priority_queue( const Compare& compare, const Container& cont, const Alloc& alloc ); |
(7) | (dal C++11) |
template< class Alloc > priority_queue( const Compare& compare, Container&& cont, const Alloc& alloc ); |
(8) | (dal C++11) |
template< class Alloc > priority_queue( const priority_queue& other, const Alloc& alloc ); |
(9) | (dal C++11) |
template< class Alloc > priority_queue( priority_queue&& other, const Alloc& alloc ); |
(10) | (dal C++11) |
template< class InputIt > priority_queue( InputIt first, InputIt last, const Compare& compare, const Container& cont ); |
(11) | (dal C++11) |
template< class InputIt > priority_queue(InputIt first, InputIt last, const Compare& compare = Compare(), Container&& cont = Container()); |
(12) | (dal C++11) |
Costruisce nuovo contenitore sottostante dell'adattatore contenitore da una varietà di fonti di dati.
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)
Copia-costruisce il
Questa è anche la (fino al c++11) costruttore predefinito|Copy-constructs the underlying container c sottostante contenitore con il contenuto di cont. Copia-costruisce la comp funtore confronto con i contenuti della compare. Chiamate 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 (fino al c++11)}}2)
Spostare-costruisce il contenitore sottostante
c con std::move(cont). Spostare-costruisce il funtore confronto comp con std::move(compare). Chiamate std::make_heap(c.begin(), c.end(), comp). Questo è anche il (dal C++11) costruttore predefinitoOriginal:
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 (dal 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)
Copia costruttore. L'adattatore è copia-costruito con i contenuti di
other.c. Il funtore confronto è costruita con std::move(other.comp). (dichiarato in modo implicito)Original:
Copy constructor. The adaptor is copy-constructed with the contents of
other.c. The comparison functor is constructed with std::move(other.comp). (dichiarato in modo implicito)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)
Sposta costruttore. L'adattatore è costruito con funtore confronto
std::move(other.c).The è costruita con std::move(other.comp). (dichiarato in modo implicito)Original:
Move constructor. The adaptor is constructed with
std::move(other.c).The comparison functor is constructed with std::move(other.comp). (dichiarato in modo implicito)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)
I seguenti costruttori sono definite solo se
std::uses_allocator<container_type, Alloc>::value == true, cioè, se il contenitore sottostante è un allocatore-consapevole contenitore (vale per tutti i contenitori della libreria 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)
Costruisce il contenitore sottostante utilizzando
alloc come allocatore. Chiama efficacemente 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)
Costruisce il contenitore sottostante utilizzando
alloc come allocatore. Chiama efficacemente c(alloc). Copia-costrutti comp da 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)
Costruisce il sottostante contenitore con il contenuto della
cont e utilizzando alloc come allocatore. Chiama efficacemente c(cont, alloc). Copia-costrutti comp da 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)
Costruisce il contenitore sottostante con i contenuti della
cont con semantica di spostamento, mentre utilizzando alloc come allocatore. Chiama efficacemente c(std::move(cont), alloc). Copia-costrutti comp da 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)
Costruisce l'adattatore con il contenuto di
other.c e utilizzando alloc come allocatore. Chiama efficacemente c(athor.c, alloc). Copia-costrutti comp da 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)
Costruisce l'adattatore con il contenuto di
other con semantica di spostamento, mentre utilizzando alloc come allocatore. Chiama efficacemente c(std::move(other.c), alloc). Spostare-costrutti comp da 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)
Copia-costrutti
c da cont e comp da compare. Poi chiama c.insert(c.end(), first, last);, e quindi chiama 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)
Spostare-costrutti
c da std::move(cont) e comp da std::move(compare). Poi chiama c.insert(c.end(), first, last);, e quindi chiama 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.
Parametri
| alloc | - | allocatore da utilizzare per tutte le allocazioni di memoria del contenitore sottostante
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 | - | altro adattatore contenitore da usare come sorgente per inizializzare il contenitore sottostante
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 | - | contenitore da usare come sorgente per inizializzare il contenitore sottostante
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'oggetto funzione di confronto per inizializzare il funtore sottostante confronto
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 | - | gamma di elementi per l'inizializzazione con
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.
| ||
Complessità
1, 3, 5, 6, 8: lineare o
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: costante
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 |
Esempio
#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
Vedi anche
assegna valori all'adattatore contenitore 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. (metodo pubblico) | |