kennen:lib:adjacent_find
Inhaltsverzeichnis
adjacent_find()
#include <algorithm>
For adjacent_find (For first, For last) For adjacent_find (For first, For last, Binary pred) For adjacent_find (Exec pol, For first, For last) For adjacent_find (Exec pol, For first, For last, Binary pred) For ranges::adjacent_find (Range r, Binary pred = {}, Proj = {}) For ranges::adjacent_find (For first, For last, Binary pred = {}, Proj = {})
Beschreibung:
Liefert einen Iterator i auf das erste Element des Bereiches [first,last),
das mit seinem Nachfolger übereinstimmt bzw.
mit seinem Nachfolger das Prädikat pred(proj(*i),proj(*(i+1))) erfüllt.
Parameter
first | Anfang des Bereiches |
last | Ende des Bereiches |
pred | zweistelliges Prädikat (Vorgabe = equal_to) |
proj | einstelliger Funktor (Vorgabe = std::identity) |
pol | parallele Ausführungsart |
Ergebnis
Rückgabewert: Iterator i mit *i == *(i+1)
bzw. pred(proj(*i), proj(*(i+1))), bei erfolgloser Suche last.
Siehe auch
Beispiel
- adjacent_find.cpp
#include <algorithm> #include <iostream> int main() { double arr[] = { 1, 2, 3, 3, 4 }; double *ptr = std::adjacent_find(arr, arr+5); if (ptr != end(arr)) { std::cout << ptr[0] << " == " << ptr[1] << '\n'; } }
kennen/lib/adjacent_find.txt · Zuletzt geändert: von 127.0.0.1
