namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


Action disabled: source
kennen:lib:find_first_of

find_first_of()

#include <algorithm>

For find_first_of (For first, For last, For2 first2, For2 last2) 
For find_first_of (For first, For last, For2 first2, For2 last2, Binary pred) 
For find_first_of (Exec pol, For first, For last, For2 first2, For2 last2) 
For find_first_of (Exec pol, For first, For last, For2 first2, For2 last2, Binary pred) 
 
For ranges::find_first_of (Range1 r1, Range2 r2, Binary pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) 
For ranges::find_first_of (For first, For last, For2 first2, For2 last2, Binary pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) 

Liefert einen Iterator i auf das erste Element x des Bereiches [first,last), das mit einem Element y des Bereiches [first2,last2) übereinstimmt bzw. für welches pred(proj1(x), proj2(y)) zutrifft.

Parameter

first Anfang eines Bereiches
last Ende eines Bereiches
first2 Anfang der Suchmenge
last2 Ende der Suchmenge
pred zweistelliges Prädikat (Vorgabe = equal_to)
proj1, proj2 einstelliger Funktor (Vorgabe = std::identity)
pol parallele Ausführungsart

Ergebnis

Rückgabewert: Iterator i auf erstes Element, bei dem mit mindestens einem Iterator j der Suchmenge *i == *j bzw. pred(proj1(*i), proj2(*j)) != false erfüllt ist. Wurde kein solches Element gefunden, wird last geliefert.

Siehe auch

Beispiel

find_first_of.cpp
#include <algorithm>
#include <iostream>
 
int main()
{
  const char str[] = "Hallo Welt";
  const char vokal[] = "aeiuo";
 
  const char *pos = std::find_first_of(str, str+10, vokal, vokal+5);
 
  if (pos != end(str)) 
  {
    std::cout << pos << '\n';
  }
}
kennen/lib/find_first_of.txt · Zuletzt geändert: 2020-06-14 14:39 von 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki