kennen:lib:min_element
Inhaltsverzeichnis
min_element()
#include <algorithm>
For min_element (For first, For last) For min_element (For first, For last, Binary comp) For min_element (Exec pol, For first, For last) For min_element (Exec pol, For first, For last, Binary comp) For ranges::min_element (Range r, Binary comp = {}, Proj proj = {}) For ranges::min_element (For first, For last, Binary comp = {}, Proj proj = {})
Liefert einen Iterator auf das kleinste Element des Bereiches [first,last).
Parameter
first | Anfang des Bereiches |
last | Ende des Bereiches |
comp | Sortierkriterium (Vorgabe = less) |
proj | einstelliger Funktor (Vorgabe = std::identity) |
pol | parallele Ausführungsart |
Ergebnis
Rückgabewert: der erste Iterator i im Bereich,
für den mit jedem anderen Iterator j in diesem Bereich
!(*j < *i) bzw. comp(proj(*j), proj(*i)) == false gilt.
Siehe auch
Beispiel
- min_element.cpp
#include <algorithm> #include <iostream> int main() { double arr[] = { 3, 2, 0, 1, 5, 4 }; std::cout << "Kleinster Wert: " << *std::min_element(arr, arr+6) << '\n'; std::cout << "Groesster Wert: " << *std::max_element(arr, arr+6) << '\n'; }
kennen/lib/min_element.txt · Zuletzt geändert: von 127.0.0.1
