Syntax:
#include <valarray> TYPE min() const;
The min() function returns the smallest element value as determined by the '<' operator. If TYPE is not a built-in type, an '<' operator must exist.
This function does not affect the contents of the valarray.
The following code will return the minimum value in the array:
#include <valarray> #include <iostream> const double vd[] = {1,2,3,4,5}; std::valarray<int> v1(vd,5); std::cout << v1.min() << std::endl;
Will produce this output:
1