void resize( std::size_t count, T value = T() ); |
Resizes the valarray to contain count
elements and assigns value
to each element.
This functions invalidates all pointers and references to elements in the array.
count | - | new size of the container |
value | - | the value to initialize the new elements with |
(none).
#include <valarray> #include <iostream> int main() { std::valarray<int> v{1,2,3}; v.resize(10); for(int n: v) std::cout << n << ' '; std::cout << '\n'; }
Output:
0 0 0 0 0 0 0 0 0 0
returns the size of valarray (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/numeric/valarray/resize