| Vorhergehende Überarbeitung |
— | kennen:lib:mismatch [2023-10-14 12:28] (aktuell) – [Beispiel] rrichter |
---|
| ====== mismatch() ====== |
| ''#include'' [[..:include:algorithm]] |
| |
| <code cpp> |
| std::pair<In, In2> mismatch (In first, In last, In2 first2) |
| std::pair<In, In2> mismatch (In first, In last, In2 first2, Binary pred) |
| std::pair<In, In2> mismatch (In first, In last, In2 first2, In2 last2) |
| std::pair<In, In2> mismatch (In first, In last, In2 first2, In2 last2, Binary pred) |
| std::pair<In, In2> mismatch (Exec pol, In first, In last, In2 first2) |
| std::pair<In, In2> mismatch (Exec pol, In first, In last, In2 first2, Binary pred) |
| std::pair<In, In2> mismatch (Exec pol, In first, In last, In2 first2, In2 last2) |
| std::pair<In, In2> mismatch (Exec pol, In first, In last, In2 first2, In2 last2, Binary pred) |
| |
| [pos1, pos2] = ranges::mismatch (Range1 r1, Range2 r2, Binary pred = {}, Proj1 proj = {}, Proj2 proj2 = {}) |
| [pos1, pos2] = ranges::mismatch (In first, In last, In2 first2, In2 last2, Binary pred = {}, Proj1 proj = {}, Proj2 proj2 = {}) |
| </code> |
| Liefert ein Paar von Iteratoren ''{pos1, pos2}'', |
| ab denen die Bereiche [first,last) und [first2,...) nicht mehr übereinstimmen bzw. |
| das Prädikat ''pred(proj1(pos1),proj2(pos2))'' nicht mehr erfüllen. |
| |
| ==== Parameter ==== |
| | ''first'' | Anfang eines Bereiches | |
| | ''last'' | Ende eines Bereiches | |
| | ''first2'' | Anfang des anderen Bereiches | |
| | ''last2'' | Ende des anderen Bereiches | |
| | ''pred'' | zweistelliges Prädikat (Vorgabe = ''equal_to'')| |
| | ''proj'' | einstelliger Funktor (Vorgabe = ''std::identity'') | |
| | ''pol'' | [[..:include:execution|parallele Ausführungsart]] | |
| ==== Ergebnis ==== |
| Rückgabewert: Iteratorpaar ''{i,j}'' auf die erste Stelle, |
| an der ''*i != *j'' bzw. ''pred(proj1(*i),proj2(*j)) == false'' |
| als ''std::pair'' |
| bzw. als Struktur mit Elementen ''in1, in2''. |
| |
| Stimmen beide Bereiche bis zum Ende eines Bereichs überein, |
| werden ''last1'' bzw. ''last2'' und der korrespondierende Iterator des anderen Bereichs geliefert. |
| |
| ==== Siehe auch ==== |
| [[equal]]. |
| |
| ==== Beispiel ==== |
| <code cpp mismatch.cpp> |
| #include <algorithm> |
| #include <iostream> |
| |
| int main() |
| { |
| const char *p = "Schreibe: Hallo"; |
| const char *q = "Schreibe: Welt"; |
| |
| std::pair<const char*, const char*> diff = std::mismatch(p, p+15, q); |
| |
| std::cout << diff.first << diff.second << '\n'; |
| } |
| </code> |
| |