std::unordered_set<Key,Hash,KeyEqual,Allocator>:: max_bucket_count
From de.cppreference.net
<
cpp
|
container
|
unordered set
|
size_type max_bucket_count
(
)
const
;
|
(seit C++11) | |
Gibt die maximale Anzahl von Buckets zurück, die der Container aufgrund von System- oder Bibliotheksimplementierungsbeschränkungen halten kann.
Inhaltsverzeichnis |
Parameter
(keine)
Rückgabewert
Maximale Anzahl von Buckets.
Komplexität
Konstante.
Beispiel
Diesen Code ausführen
#include <iostream> #include <unordered_set> int main() { struct Ha { std::size_t operator()(long x) const { return std::hash<long>{}(x); }; }; auto c1 = std::unordered_set<char>{}; auto c2 = std::unordered_set<long>{}; auto c3 = std::unordered_set<long, std::hash<int>>{}; auto c4 = std::unordered_set<long, Ha>{}; std::cout << "Max bucket count of\n" << std::hex << std::showbase << "c1: " << c1.max_bucket_count() << '\n' << "c2: " << c2.max_bucket_count() << '\n' << "c3: " << c3.max_bucket_count() << '\n' << "c4: " << c4.max_bucket_count() << '\n' ; }
Mögliche Ausgabe:
Max bucket count of c1: 0xfffffffffffffff c2: 0xfffffffffffffff c3: 0xfffffffffffffff c4: 0xaaaaaaaaaaaaaaa
Siehe auch
|
gibt die Anzahl der Buckets zurück
(öffentliche Elementfunktion) |