[ Web Proxy ]
URL:
Viewing: https://de.cppreference.com/cpp/container/vector/push_back [Back]  [Original]

std::vector::push_back cppreference.com
cppreference.com
Namensrume
Varianten

std::vector::push_back

Aus cppreference.com

<metanoindex/>

 
 
 
std::vector
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.
vector::vector
vector::~vector
vector::operator=
vector::assign
vector::get_allocator
Elementzugriff zerstrt
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.
vector::at
vector::operator[]
vector::front
vector::back
vector::data(C++11)
Iteratoren
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
vector::begin
vector::cbegin

(C++11)
vector::end
vector::cend

(C++11)
vector::rbegin
vector::crbegin

(C++11)
vector::rend
vector::crend

(C++11)
Kapazitt
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
vector::empty
vector::size
vector::max_size
vector::reserve
vector::capacity
vector::shrink_to_fit(C++11)
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.
vector::clear
vector::insert
vector::emplace(C++11)
vector::erase
vector::push_back
vector::emplace_back(C++11)
vector::pop_back
vector::resize
vector::swap
 
<tbody> </tbody>
void push_back( const T& value );
void push_back( T&& value );
(seit C++11)
Hngt den gegebenen Element value an das Ende des Behlters .
Original:
Appends the given element value to the end of the container.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

If the new size() is greater than capacity(), all iterators and references are invalidated. Otherwise no iterators and references are invalidated.

Parameter

value -
der Wert des Elements, anzuhngen
Original:
the value of the element to append
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Anforderungen

1)

value wird CopyInsertable sein
Original:
value shall be CopyInsertable
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

2)

value wird MoveInsertable sein
Original:
value shall be MoveInsertable
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Rckgabewert

(None)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Komplexitt

Constant .
Original:
Constant.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Beispiel

Der folgende Code verwendet push_back mehrere Zahlen zu einem std::vector<int> hinzu:
Original:
The following code uses push_back to add several integers to a std::vector<int>:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <vector>
#include <iostream>
 
int main()
{
    std::vector<int> numbers;
 
    numbers.push_back(42);
    numbers.push_back(314159); 

    for (int i : numbers) { // c++11 range-based for loop
        std::cout << i << '\n';
    } 

    return 0;
}

Output:

42
314159

Siehe auch

None
baut Elemente-Platz am Ende
Original:
constructs elements in-place at the end
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]
entfernt das letzte Element
Original:
removes the last element
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]

Web Proxy Viewer  |  New URL  |  Original Page