Espaços nominais
Variantes
Acções

std::priority_queue::priority_queue

Da cppreference.com

 
 
 
std :: priority_queue
Funções de membro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
priority_queue::priority_queue
priority_queue::~priority_queue
priority_queue::operator=
acesso. Elemento
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
priority_queue::top
Capacidade
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
priority_queue::empty
priority_queue::size
Modificadores
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
priority_queue::push
priority_queue::emplace
priority_queue::pop
priority_queue::swap
 
explicit priority_queue(const Compare& compare = Compare(),

                         const Container& cont = Container());

priority_queue(const Compare& compare, const Container& cont);
(1) (até C++11)

(desde C++11)
explicit priority_queue(const Compare& compare = Compare(),
                         Container&& cont = Container());
(2) (desde C++11)
priority_queue(const priority_queue& other );
(3)
priority_queue( priority_queue&& other );
(4) (desde C++11)
template<class Alloc >
explicit priority_queue(const Alloc& alloc );
(5) (desde C++11)
template<class Alloc >
priority_queue(const Compare& compare, const Alloc& alloc );
(6) (desde C++11)
template<class Alloc >

priority_queue(const Compare& compare, const Container& cont,

                const Alloc& alloc );
(7) (desde C++11)
template<class Alloc >

priority_queue(const Compare& compare, Container&& cont,

                const Alloc& alloc );
(8) (desde C++11)
template<class Alloc >
priority_queue(const priority_queue& other, const Alloc& alloc );
(9) (desde C++11)
template<class Alloc >
priority_queue( priority_queue&& other, const Alloc& alloc );
(10) (desde C++11)
template<class InputIt >

priority_queue( InputIt first, InputIt last,

                const Compare& compare, const Container& cont );
(11) (desde C++11)
template<class InputIt >

priority_queue(InputIt first, InputIt last,

               const Compare& compare = Compare(), Container&& cont = Container());
(12) (desde C++11)
Constrói recipiente subjacente do novo adaptador de recipiente a partir de uma variedade de fontes de dados.
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.
1)
Copiar-constrói o recipiente subjacente c com o conteúdo de cont. Copiar-constrói o comp functor comparação com o conteúdo de compare. Chama 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.
Esta é também a (até C++11) construtor padrão|Copy-constructs the underlying container 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 (até C++11)}}
2)
Mover-constrói o recipiente subjacente c com std::move(cont). Mova-constrói o functor comparação com compstd::move(compare). Chama std::make_heap(c.begin(), c.end(), comp). Este é também o (desde C++11) construtor padrão
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 (desde C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Copie construtor. O adaptador é construído de cópia com o conteúdo de other.c. O functor comparação é construído com std::move(other.comp). (declarada implicitamente)
Original:
Copy constructor. The adaptor is copy-constructed with the contents of other.c. The comparison functor is constructed with std::move(other.comp). (declarada implicitamente)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Mova construtor. O adaptador é construído com functor comparação std::move(other.c).The é construído com std::move(other.comp). (declarada implicitamente)
Original:
Move constructor. The adaptor is constructed with std::move(other.c).The comparison functor is constructed with std::move(other.comp). (declarada implicitamente)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5-10)
Os construtores seguintes são definidos apenas se std::uses_allocator<container_type, Alloc>::value==true, isto é, se o contêiner subjacente é um recipiente alocador-aware (válido para todos os contêineres da biblioteca padrão).
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.
5)
Constrói o recipiente subjacente usando alloc como alocador. Efetivamente chama 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.
6)
Constrói o recipiente subjacente usando alloc como alocador. Efetivamente chama c(alloc). Copy-construções 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.
7)
Constrói o recipiente subjacente com o conteúdo de cont e utilizando como alloc alocador. Efetivamente chama c(cont, alloc). Copy-construções 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.
8)
Constrói o recipiente subjacente com o conteúdo de cont usando semântica mover enquanto utilizando alloc como alocador. Efetivamente chama c(std::move(cont), alloc). Copy-construções 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.
9)
Constrói o adaptador com o conteúdo de other.c e utilizando como alloc alocador. Efetivamente chama c(athor.c, alloc). Copy-construções 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.
10)
Constrói o adaptador com o conteúdo de other usando semântica mover enquanto utilizando alloc como alocador. Efetivamente chama c(std::move(other.c), alloc). Mova-construções 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.
11)
Copy-construtos c de cont e comp de compare. Em seguida, chama c.insert(c.end(), first, last); e chama 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.
12)
Move-construções c de std::move(cont) e comp de std::move(compare). Em seguida, chama c.insert(c.end(), first, last); e chama 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.

Índice

[editar]Parâmetros

alloc -
alocador de usar para todas as alocações de memória do recipiente subjacente
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 -
outro adaptador de recipiente a ser utilizado como fonte para inicializar o recipiente subjacente
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 -
recipiente para ser utilizado como fonte para inicializar o recipiente subjacente
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 -
o objeto função de comparação para inicializar o functor comparação subjacente
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 -
intervalo de elementos para inicializar com
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.

[editar]Complexidade

1, 3, 5, 6, 8: linear em cont ou other
Original:
1, 3, 5, 6, 8: linear in cont or other
The text has been machine-translated via Google Translate.
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.

[editar]Exemplo

#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';}

Saída:

1 1 5

[editar]Veja também

atribui valores ao adaptador de recipiente
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.

(função pública membro)[edit]
close