Espaços nominais
Variantes
Acções

std::vector

Da cppreference.com
< cpp‎ | container
 
 
 
std::vector
Funções de membro
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
acesso. Elemento
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)
Iteradores
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)
Capacidade
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)
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.
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
 
Definido no cabeçalho <vector>
template<

    class T,
    class Allocator = std::allocator<T>

> class vector;
(1)
namespace pmr {

    template <class T>
    using vector = std::vector<T, std::pmr::polymorphic_allocator<T>>;

}
(2)
1) std::vector
é um recipiente sequencial que encapsula vetores de tamanho dinâmico.
Original:
is a sequence container that encapsulates dynamic size arrays.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2) std::pmr::vector
é um alias template que usa um polymorphic allocator.
Original:
is an alias template that uses a polymorphic allocator.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


Os elementos são armazenados de forma contígua, o que significa que os elementos podem ser acessados não só através de iteradores, mas também com deslocamentos em ponteiros regulares aos elementos. Isto significa que um ponteiro para um elemento de um vector pode ser passado para qualquer função que espera um ponteiro para um elemento de uma matriz.
Original:
The elements are stored contiguously, which means that elements can be accessed not only through iterators, but also using offsets on regular pointers to elements. This means that a pointer to an element of a vector may be passed to any function that expects a pointer to an element of an array.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


O armazenamento do vector é feita automaticamente, sendo expandido e contraído, conforme necessário. Vetores geralmente ocupam mais espaço do que arrays estáticos, porque mais memória é alocada para lidar com o crescimento futuro. Desta forma, um vector não necessita de reatribuir cada vez que um elemento é inserido, mas apenas quando a memória adicional está esgotado. A quantidade total de memória alocada pode ser consultada usando função capacity(). Memória extra pode ser retornada para o sistema através de uma chamada a shrink_to_fit().
Original:
The storage of the vector is handled automatically, being expanded and contracted as needed. Vectors usually occupy more space than static arrays, because more memory is allocated to handle future growth. This way a vector does not need to reallocate each time an element is inserted, but only when the additional memory is exhausted. The total amount of allocated memory can be queried using capacity() function. Extra memory can be returned to the system via a call to shrink_to_fit().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click