Espacios de nombres
Variantes
Acciones

std::stack::stack

De cppreference.com
< cpp‎ | container‎ | stack

 
 
 
std :: pila
Las funciones miembro
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.
stack::stack
stack::~stack
stack::operator=
Elemento acceso
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.
stack::top
Capacidad
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
stack::empty
stack::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.
stack::push
stack::emplace
stack::pop
stack::swap
 
explicit stack( const Container& cont = Container() );
explicit stack( const Container& cont );
(1) (hasta C++11)
(desde C++11)
explicit stack( Container&& cont = Container() );
(2) (desde C++11)
stack( const stack& other );
(3)
stack( stack&& other );
(4) (desde C++11)
template< class Alloc >
explicit stack( const Alloc& alloc );
(5) (desde C++11)
template< class Alloc >
stack( const Container& cont, const Alloc& alloc );
(6) (desde C++11)
template< class Alloc >
stack( Container&& cont, const Alloc& alloc );
(7) (desde C++11)
template< class Alloc >
stack( const stack& other, const Alloc& alloc );
(8) (desde C++11)
template< class Alloc >
stack( stack&& other, const Alloc& alloc );
(9) (desde C++11)
Constructos de nuevo contenedor subyacente del adaptador del recipiente de una variedad de fuentes de datos .
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)
Copia-construye el c contenedor subyacente con el contenido de cont. Este es también el (hasta C++11) constructor predeterminado
Original:
Copy-constructs the underlying container c with the contents of cont. This is also the default constructor (hasta C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Mover-construye el contenedor subyacente c con std::move(cont). Este es también el (desde C++11) constructor predeterminado
Original:
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.
3)
Copiar constructor. El adaptador está construido de copia con el contenido de other.c. (implícitamente declarado)
Original:
Copy constructor. The adaptor is copy-constructed with the contents of other.c. (implícitamente declarado)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Mueva constructor. El adaptador está construido con std::move(other.c). (implícitamente declarado)
Original:
Move constructor. The adaptor is constructed with std::move(other.c). (implícitamente declarado)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5-9)
Los constructores siguientes se definen solamente si std::uses_allocator<container_type, Alloc>::value == true, es decir, si el contenedor es un contenedor subyacente asignador-conscientes (verdadero para todos los contenedores de la biblioteca estándar) .
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)
Construye el contenedor subyacente utilizando alloc como asignador. Efectivamente llama 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.
6)
Construye el contenedor subyacente con el contenido de cont y utilizando alloc como asignador. Efectivamente llama 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.
7)
Construye el contenedor subyacente con el contenido de cont utilizando la semántica de movimiento mientras que la utilización alloc como asignador. Efectivamente llama 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.
8)
Construye el adaptador con el contenido de other.c y utilizando alloc como asignador. Efectivamente llama 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.
9)
Construye el adaptador con el contenido de other utilizando la semántica de movimiento mientras que la utilización alloc como asignador. Efectivamente llama 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.

Contenido

[editar] Parámetros

alloc -
asignador de usar para todas las asignaciones de memoria del contenedor subyacente
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 -
otro adaptador del recipiente para ser utilizado como fuente para inicializar el contenedor subyacente
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 -
contenedor para ser utilizado como fuente para inicializar el contenedor subyacente
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 -
serie de elementos a inicializar 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.

[editar] Complejidad

1, 3, 5, 6, 8: lineal en cont o 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] Ejemplo

#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] Ver también

asigna valores al 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.

(miembro público función) [edit]