min [C++ Reference]
Keywords: valarray,min
Date: 2009-06-26T10:57:56-0700

[[min]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## min

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

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •