It returns the minimum value contained in the valarray, as if the elements were compared with operator<.
DeclarationFollowing is the declaration for std::valarray::min function.
T min() const;C++11
T min() const;Parameters
none
Return ValueIt returns the minimum value contained in the valarray, as if the elements were compared with operator<.
ExceptionsBasic guarantee − if any operation performed on the elements throws an exception.
Data racesAll elements effectively copied are accessed.
ExampleIn below example explains about std::valarray::min function.
#include <iostream> #include <valarray> int main () { int init[]={20,40,0,30}; std::valarray<int> myvalarray (init,4); std::cout << "The min is " << myvalarray.min() << '\n'; return 0; }
Let us compile and run the above program, this will produce the following result −
The min is 0
valarray.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4