std::stack::stack
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. |
explicit stack( const Container& cont = Container() ); explicit stack( const Container& cont ); |
(1) | (C fino + 11) (dal C++11) |
explicit stack( Container&& cont = Container() ); |
(2) | (dal C++11) |
stack( const stack& other ); |
(3) | |
stack( stack&& other ); |
(4) | (dal C++11) |
template< class Alloc > explicit stack( const Alloc& alloc ); |
(5) | (dal C++11) |
template< class Alloc > stack( const Container& cont, const Alloc& alloc ); |
(6) | (dal C++11) |
template< class Alloc > stack( Container&& cont, const Alloc& alloc ); |
(7) | (dal C++11) |
template< class Alloc > stack( const stack& other, const Alloc& alloc ); |
(8) | (dal C++11) |
template< class Alloc > stack( stack&& other, const Alloc& alloc ); |
(9) | (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
c
sottostante contenitore con il contenuto di cont
. Questo è anche il (C fino + 11) costruttore predefinitoOriginal:
Copy-constructs the underlying container
c
with the contents of cont
. This is also the default constructor (C fino + 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)
Spostare-costruisce il contenitore sottostante
c
con std::move(cont). Questo è anche il (dal C++11) costruttore predefinitoOriginal:
Move-constructs the underlying container
c
with std::move(cont). 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. (dichiarato in modo implicito)
Original:
Copy constructor. The adaptor is copy-constructed with the contents of other.c. (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 è realizzato con std::move(other.c). (dichiarato in modo implicito)
Original:
Move constructor. The adaptor is constructed with std::move(other.c). (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-9)
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).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)
Costruisce il sottostante contenitore con il contenuto della
cont
e utilizzando alloc
come allocatore. Chiama efficacemente 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)
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).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)
Costruisce l'adattatore con il contenuto di
other.c
e utilizzando alloc
come allocatore. Chiama efficacemente 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)
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).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.
Indice |
[modifica] 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. |
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 .
|
[modifica] Complessità
1, 3, 5, 6, 8: lineare o
cont
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: 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 |
[modifica] Esempio
#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
[modifica] 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) |