namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


Action disabled: source
kennen:lib:partition_point

partition_point()

#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.

Parameter

first Anfang des Bereiches
last Ende des Bereiches
pred Prädikat
proj einstelliger Funktor (Vorgabe = std::identity)
pol parallele Ausführungsart

Ergebnis

Rückgabewert: Iterator mid, so dass sowohl std::all_of(first,mid, pred) als auch std::none_of(mid,last,pred) erfüllt ist.

Siehe auch

Beispiel

partition_point.cpp
#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';
}
kennen/lib/partition_point.txt · Zuletzt geändert: 2020-06-16 16:55 von 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki