std::queue::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 queue( const Container& cont = Container() ); explicit queue( const Container& cont ); |
(1) | (até C++11) (desde C++11) |
explicit queue( Container&& cont = Container() ); |
(2) | (desde C++11) |
queue( const queue& other ); |
(3) | |
queue( queue&& other ); |
(4) | (desde C++11) |
template< class Alloc > explicit queue( const Alloc& alloc ); |
(5) | (desde C++11) |
template< class Alloc > queue( const Container& cont, const Alloc& alloc ); |
(6) | (desde C++11) |
template< class Alloc > queue( Container&& cont, const Alloc& alloc ); |
(7) | (desde C++11) |
template< class Alloc > queue( const queue& other, const Alloc& alloc ); |
(8) | (desde C++11) |
template< class Alloc > queue( queue&& other, const Alloc& alloc ); |
(9) | (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.
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. Este é também o (até C++11) construtor padrãoOriginal:
Copy-constructs the underlying container
c with the contents of cont. This is also the default constructor (até 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.
2)
Mover-constrói o recipiente subjacente
c com std::move(cont). Este é também o (desde C++11) construtor padrãoOriginal:
Move-constructs the underlying container
c with std::move(cont). 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.
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. (declarada implicitamente)Original:
Copy constructor. The adaptor is copy-constructed with the contents of
other.c. (declarada implicitamente)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)
Mova construtor. O adaptador é construído com
std::move(other.c). (declarada implicitamente)Original:
Move constructor. The adaptor is constructed with
std::move(other.c). (declarada implicitamente)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-9)
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.
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).Original:
Constructs the underlying container using
alloc as allocator. Effectively calls c(alloc).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)
Constrói o recipiente subjacente com o conteúdo de
cont e utilizando como alloc alocador. Efetivamente chama c(cont, alloc).Original:
Constructs the underlying container with the contents of
cont and using alloc as allocator. Effectively calls c(cont, alloc).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)
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).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).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)
Constrói o adaptador com o conteúdo de
other.c e utilizando como alloc alocador. Efetivamente chama c(athor.c, alloc).Original:
Constructs the adaptor with the contents of
other.c and using alloc as allocator. Effectively calls c(athor.c, alloc).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)
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).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).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.
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. |
| 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.
| ||
Complexidade
1, 3, 5, 6, 8: linear em
cont ou 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.
| Esta seção está incompleta |
Exemplo
#include <queue>
#include <deque>
#include <iostream>
int main()
{
std::queue<int> c1;
c1.push(5);
std::cout << c1.size() << '\n';
std::queue<int> c2(c1);
std::cout << c2.size() << '\n';
std::deque<int> deq {3, 1, 4, 1, 5};
std::queue<int> c3(deq);
std::cout << c3.size() << '\n';
}
Saída:
1
1
5
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) | |