namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


kennen:lib:is_heap

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.


kennen:lib:is_heap [2020-06-16 17:11] (aktuell) – angelegt - Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 +====== is_heap() ======
 +''#include'' [[..:include:algorithm]]
 +
 +<code cpp>
 +bool is_heap (Ran first, Ran last) 
 +bool is_heap (Ran first, Ran last, Binary comp) 
 + 
 +bool is_heap (Exec pol, Ran first, Ran last) 
 +bool is_heap (Exec pol, Ran first, Ran last, Binary comp) 
 + 
 +bool ranges::is_heap (Range r, Binary comp = {}, Proj proj = {}) 
 +bool ranges::is_heap (Ran first, Ran last, Binary comp = {}, Proj proj = {}) 
 +</code>
 + Prüft, ob der Bereich [first,last) als [[..:begriffe#Heap]] geordnet ist. 
 +
 +==== Parameter ====
 +| ''first'' | Anfang des Bereiches |
 +| ''last''  | Ende des Bereiches |
 +| ''comp''  | Vergleichskriterium (Vorgabe = ''less'')|
 +| ''proj''  | einstelliger Funktor (Vorgabe = ''std::identity'') |
 +| ''pol''   | [[..:include:execution|parallele Ausführungsart]] |
 +
 +==== Ergebnis ====
 +Rückgabewert: ''true'', wenn der Bereich [first, last) als Heap geordnet ist.
 +
 +==== Siehe auch ====
 +[[is_heap_until]],
 +[[make_heap]],
 +[[sort_heap]].
 +
 +==== Beispiel ====
 +<code cpp is_heap.cpp>
 +#include <algorithm>
 +#include <iostream>
 +#include <vector>
 +
 +int main()
 +{
 +  std::vector<int> v = { 3, 7, 2, 0, 1, 9, 4, 6, 5, 8 };
 +
 +  std::make_heap(begin(v), end(v));
 +
 +  for(auto e : v) std::cout << e << " "; std::cout << '\n';
 + std::cout << "is_heap? " << std::is_heap(begin(v), end(v)) << '\t';
 +}
 +</code>
  
kennen/lib/is_heap.txt · Zuletzt geändert: 2020-06-16 17:11 von 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki