名前空間
変種
操作

std::valarray<T>::max

提供: cppreference.com
< cpp‎ | numeric‎ | valarray
 
 
 
 
T max() const;

要素の最大値を計算します。

要素がない場合、動作は未定義です。

この関数は型 T に対して operator< が定義されている場合にのみ使用できます。

目次

[編集] 引数

(なし)

[編集] 戻り値

要素の最大値。

[編集]

#include <valarray>
#include <iostream>
 
int main()
{
    std::valarray<double> a{1, 2, 3, 4, 5, 6, 7, 8};
    std::cout << "Maximum value : " << a.max() << "\n";
}

出力:

Maximum value : 8

[編集] 関連項目

最も小さい要素を返します
(パブリックメンバ関数) [edit]