std::stack::stack
Da 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. |
explicit stack( const Container& cont = Container() ); explicit stack( const Container& cont ); |
(1) | (até C + 11) (a partir do C++ 11) |
explicit stack( Container&& cont = Container() ); |
(2) | (a partir do C++ 11) |
stack( const stack& other ); |
(3) | |
stack( stack&& other ); |
(4) | (a partir do C++ 11) |
template< class Alloc > explicit stack( const Alloc& alloc ); |
(5) | (a partir do C++ 11) |
template< class Alloc > stack( const Container& cont, const Alloc& alloc ); |
(6) | (a partir do C++ 11) |
template< class Alloc > stack( Container&& cont, const Alloc& alloc ); |
(7) | (a partir do C++ 11) |
template< class Alloc > stack( const stack& other, const Alloc& alloc ); |
(8) | (a partir do C++ 11) |
template< class Alloc > stack( stack&& other, const Alloc& alloc ); |
(9) | (a partir do 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 (a partir do C++ 11) construtor padrãoOriginal:
Move-constructs the underlying container
c
with std::move(cont). This is also the default constructor (a partir do 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.
Í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. |
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.
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 |
[editar] Exemplo
#include <stack> #include <deque> #include <iostream> int main() { std::stack<int> c1; c1.push(5); std::cout << c1.size() << '\n'; std::stack<int> c2(c1); std::cout << c2.size() << '\n'; std::deque<int> deq {3, 1, 4, 1, 5}; std::stack<int> c3(deq); std::cout << c3.size() << '\n'; }
Output:
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) |