Espaces de noms
Variantes
Affichages
Actions

std::stack::stack

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

 
 
 
std :: pile
Les fonctions membres
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=
Elément d'accès
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
Capacité
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
Modificateurs
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) (avant C++11)
(depuis C++11)
explicit stack( Container&& cont = Container() );
(2) (depuis C++11)
stack( const stack& other );
(3)
stack( stack&& other );
(4) (depuis C++11)
template< class Alloc >
explicit stack( const Alloc& alloc );
(5) (depuis C++11)
template< class Alloc >
stack( const Container& cont, const Alloc& alloc );
(6) (depuis C++11)
template< class Alloc >
stack( Container&& cont, const Alloc& alloc );
(7) (depuis C++11)
template< class Alloc >
stack( const stack& other, const Alloc& alloc );
(8) (depuis C++11)
template< class Alloc >
stack( stack&& other, const Alloc& alloc );
(9) (depuis C++11)
Construit nouveau conteneur sous-jacent de l'adaptateur de réservoir à partir d'une variété de sources de données .
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)
Copie-construit le récipient sous-jacent c avec le contenu de cont. C'est aussi le (avant C++11) constructeur par défaut
Original:
Copy-constructs the underlying container c with the contents of cont. This is also the default constructor (avant 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)
Déplacez-construit le conteneur sous-jacent c avec std::move(cont). C'est aussi le (depuis C++11) constructeur par défaut
Original:
Move-constructs the underlying container c with std::move(cont). This is also the default constructor (depuis 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)
Copiez constructeur. L'adaptateur est construit avec la copie du contenu de other.c. (implicitement déclaré)
Original:
Copy constructor. The adaptor is copy-constructed with the contents of other.c. (implicitement déclaré)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Déplacez constructeur. L'adaptateur est construit avec std::move(other.c). (implicitement déclaré)
Original:
Move constructor. The adaptor is constructed with std::move(other.c). (implicitement déclaré)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5-9)
Les constructeurs suivants ne sont définies que si std::uses_allocator<container_type, Alloc>::value == true, qui est, si le conteneur sous-jacent est un conteneur d'allocation-aware (valable pour tous les conteneurs de la bibliothèque 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.
5)
Construit le conteneur sous-jacent à l'aide alloc comme allocateur. Appelle effectivement 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)
Construit le récipient sous-jacent sur le contenu de cont et en utilisant comme alloc allocateur. Appelle effectivement 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)
Construit le récipient sous-jacent sur le contenu de cont utilisant une sémantique de déplacement tout en utilisant comme alloc allocateur. Appelle effectivement 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)
Construit l'adaptateur avec le contenu de other.c et en utilisant comme alloc allocateur. Appelle effectivement 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)
Construit l'adaptateur avec le contenu de other utilisant une sémantique de déplacement tout en utilisant comme alloc allocateur. Appelle effectivement 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.

Sommaire

[modifier] Paramètres

alloc -
allocateur à utiliser pour toutes les allocations de mémoire du conteneur sous-jacent
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 -
un autre adaptateur de réservoir à être utilisé en tant que source pour initialiser le conteneur sous-jacent
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 -
Récipient pour être utilisé comme source pour initialiser le conteneur sous-jacent
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 -
éventail d'éléments à initialiser avec
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.

[modifier] Complexité

1, 3, 5, 6, 8: linéaire ou 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.
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.

[modifier] Exemple

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

Résultat :

1
1
5

[modifier] Voir aussi

Attribue les valeurs dans l'adaptateur de conteneur
(fonction membre publique) [edit]