Namensräume
Varianten

std::stack::stack

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

 
 
 
std :: stack
Member-Funktionen
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=
Elementzugriff zerstört
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
Kapazität
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
Modifiers
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) (bis C + +11)
(seit C++11)
explicit stack( Container&& cont = Container());
(2) (seit C++11)
stack(const stack& other );
(3)
stack( stack&& other );
(4) (seit C++11)
template<class Alloc >
explicit stack(const Alloc& alloc );
(5) (seit C++11)
template<class Alloc >
stack(const Container& cont, const Alloc& alloc );
(6) (seit C++11)
template<class Alloc >
stack( Container&& cont, const Alloc& alloc );
(7) (seit C++11)
template<class Alloc >
stack(const stack& other, const Alloc& alloc );
(8) (seit C++11)
template<class Alloc >
stack( stack&& other, const Alloc& alloc );
(9) (seit C++11)
Konstrukte neue darunterliegenden Behälter des Behälters Adapter aus einer Vielzahl von Datenquellen .
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)
Kopiergeschützte konstruiert den darunterliegenden Behälter c mit dem Inhalt cont. Dies ist auch die Default-Konstruktor (bis C + +11)
Original:
Copy-constructs the underlying container c with the contents of cont. This is also the default constructor (bis 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)
Move-baut der zugrunde liegenden Container c mit std::move(cont). Dies ist auch die Default-Konstruktor (seit C++11)
Original:
Move-constructs the underlying container c with std::move(cont). This is also the default constructor (seit 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)
Kopieren Konstruktor. Der Adapter ist mit dem Inhalt des other.c kopiergeschützten konstruiert. (implizit deklariert)
Original:
Copy constructor. The adaptor is copy-constructed with the contents of other.c. (implizit deklariert)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Bewegen Konstruktor. Der Adapter ist mit std::move(other.c) gebaut. (implizit deklariert)
Original:
Move constructor. The adaptor is constructed with std::move(other.c). (implizit deklariert)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5-9)
Die folgenden Konstruktoren nur wenn std::uses_allocator<container_type, Alloc>::value==true, das heißt wenn der Basiswert Behälter eine Zuordner-fähigen Behälter (gilt für alle Standard-Bibliothek Behältern) ist definiert .
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)
Konstruiert den zugrunde liegenden Container mit alloc als Allocator. Effektiv nennt 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)
Konstruiert den darunterliegenden Behälter mit dem Inhalt und die Verwendung contalloc als Zuordner. Effektiv nennt 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)
Konstruiert den darunterliegenden Behälter mit dem Inhalt unter Verwendung cont bewegen Semantik unter Ausnutzung alloc als Zuordner. Effektiv nennt 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)
Konstrukte den Adapter mit dem Inhalt und die Verwendung other.calloc als Zuordner. Effektiv nennt 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)
Konstruiert den Adapter mit dem Inhalt der other mit move-Semantik unter Ausnutzung alloc als Allocator. Effektiv nennt 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.

Inhaltsverzeichnis

[Bearbeiten]Parameter

alloc -
allocator für alle Speicherzuordnungen des zugrunde liegenden Behälter
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 -
ein weiterer Container Adapter als Quelle, um den darunter liegenden Behälter zu initialisieren verwendet werden
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 -
Behälter zu der als Quelle für die darunterliegenden Behälter zu initialisieren verwendet werden
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 -
Bereich von Elementen mit initialisieren
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.

[Bearbeiten]Komplexität

1, 3, 5, 6, 8: linear in cont oder 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: Konstante
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.

[Bearbeiten]Beispiel

#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

[Bearbeiten]Siehe auch

weist Werte auf den Behälter-Adapter
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.

(öffentliche Elementfunktion)[edit]
close