Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::valarray::resize(3)      C++ Standard Libary     std::valarray::resize(3)

NAME
       std::valarray::resize - std::valarray::resize

Synopsis
	  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.

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

Return value
	  (none)

Example
       // Run this code

	#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

See also
	  size returns the size	of valarray
	       (public member function)

http://cppreference.com		  2022.07.31	      std::valarray::resize(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::valarray::resize&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help