namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


kennen:lib:mismatch

mismatch()

#include <algorithm>

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 = {})

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

Beispiel

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';
}
kennen/lib/mismatch.txt · Zuletzt geändert: 2023-10-14 12:28 von rrichter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki