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

std::vector::push_back cppreference.com
cppreference.com

std::vector::push_back

cppreference.com

<metanoindex/>

<tbody> </tbody>
void push_back( const T& value );
void push_back( T&& value );
( C++11)
value .
:
Appends the given element value to the end of the container.
Google.
. .

size() , capacity(), . , .

value
:
the value of the element to append
Google.
. .

1)

value CopyInsertable
:
value shall be CopyInsertable
Google.
. .

2)

value MoveInsertable
:
value shall be MoveInsertable
Google.
. .

()

.
:
Constant.
Google.
. .

push_back std::vector<int>
:
The following code uses push_back to add several integers to a std::vector<int>:
Google.
. .

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

:

42
314159

.

None

(public -) []

(public -) []

Web Proxy Viewer  |  New URL  |  Original Page