kennen:lib:remove_copy_if
Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
remove_copy_if()
#include
<algorithm>
Out remove_copy_if (In first, In last, Out result, Pred pred) Out remove_copy_if (Exec pol, In first, In last, Out result, Pred pred) [last, res] = ranges::remove_copy_if (Range r, Out result, Pred pred, Proj proj = {}) [last, res] = ranges::remove_copy_if (In first, In last, Out result, Pred pred, Proj proj = {})
Kopiert den Bereich [first,last) nach [result,…)
und entfernt dabei alle Elemente, auf die pred(x)
zutrifft.
Parameter
first | Anfang des Bereiches |
last | Ende des Bereiches |
result | Anfang des Zielbereiches |
wert | zu entfernender Wert |
pred | einstelliges Prädikat |
proj | einstelliger Funktor (Vorgabe = std::identity ) |
pol | parallele Ausführungsart |
Ergebnis
Rückgabewert: Iterator auf das Ende des Zielbereiches.
Siehe auch
Beispiel
- remove_copy_if.cpp
#include <algorithm> #include <functional> #include <iterator> #include <string> #include <iostream> int main() { std::string s = "Hallo, Welt"; std::string t; std::cout << s << '\n'; std::remove_copy_if(begin(s), end(s), std::back_inserter(t), [](char c) { return c < 'l'; }); std::cout << t << '\n'; return 0; }
kennen/lib/remove_copy_if.1697277759.txt.gz · Zuletzt geändert: 2023-10-14 12:02 von rrichter