#include
<algorithm>
For partition_point (For first, For last, Pred pred) For ranges::partition_point (Range r, Pred pred, Proj proj = {}) For ranges::partition_point (For first, For last, Pred pred, Proj proj = {})
Liefert den Iterator hinter das letzte Element e
im partitionierten Bereich [first,last),
auf welches pred(proj(e))
zutrifft.
first | Anfang des Bereiches |
last | Ende des Bereiches |
pred | Prädikat |
proj | einstelliger Funktor (Vorgabe = std::identity ) |
pol | parallele Ausführungsart |
Rückgabewert: Iterator mid
,
so dass sowohl std::all_of(first,mid, pred)
als auch std::none_of(mid,last,pred)
erfüllt ist.
#include <algorithm> #include <iostream> #include <string> int main() { std::string s = "HALLO, Welt"; auto mid = std::partition_point(begin(s), end(s), [](char c) {return c <= 'Z';}); std::string gut(begin(s),mid); // ins Toepfchen std::string schlecht(mid, end(s)); // ins Kroepfchen std::cout << gut << " : " << schlecht << '\n'; }