namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


Action disabled: source
kennen:lib:count

count()

#include <algorithm>

difference_type count (In first, In last, T wert) 
difference_type count (Exec pol, In first, In last, T wert) 
 
difference_type ranges::count (Range r, T wert, Proj proj = {}) 
difference_type ranges::count (In first, In last, T wert, Proj proj = {}) 

Liefert die Anzahl der Elemente e des Bereiches [first,last) mit proj(e) == wert.

Parameter

first Anfang des Bereiches
last Ende des Bereiches
wert Wert der zu zählenden Elemente
proj einstelliger Funktor (Vorgabe = std::identity)
pol parallele Ausführungsart

Ergebnis

Rückgabewert: Anzahl der Iteratoren i im Bereich [first,last), für die proj(*i) == wert ist.

Siehe auch

Beispiel

count.cpp
#include <algorithm>
#include <iostream>
#include <string>
 
int main()
{
  std::string s = "Mississippi";
  std::cout << std::count(begin(s), end(s), 'i') << '\n';
}
kennen/lib/count.txt · Zuletzt geändert: 2020-06-14 12:57 von 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki