std::vector::resize

From Cppreference

Jump to: navigation, search
void resize( size_type count, T value = T() );

void resize( size_type count);

void resize( size_type count, const value_type& value);
(pre-C++11 version)
(C++11 version)
(C++11 version)

Resizes the container to contain count elements.

If the current size is less than count, additional elements are appended and initialized with value.

If the current size is greater than count, the container is reduced to its first count elements.

Contents

[edit] Parameters

count - new size of the container
value - the value to initialize the new elements with

[edit] Return value

(none)

[edit] Complexity

linear in the size of the container

[edit] See also

size
returns the number of elements
(public member function)