====== max_element ====== // pred type : 要素を2つ引数にとってboolを返す呼び出し可能型 // return type : Any Iterator::max_element: method(pred: null); ===== Description ===== イテレート対象要素のうち最大の値を返します。//pred//を指定した場合はそれを使い、そうでなければ operator < を利用して比較します。 ===== Example ===== 乱数で初期化した配列から最大の値と0.5未満で最大の値を取り出す ==== C++ ==== ==== Xtal ==== array : []; 10.times{ array.push_back(math::random()); } array.p; array.max_element.p; array.filter(|x| x<0.5).max_element.p; ==== Output ==== [7.82637e-006, 0.131538, 0.755605, 0.45865, 0.532767, 0.218959, 0.0470446, 0.678865, 0.679296, 0.934693] 0.934693 0.45865