std::unordered_multimap<Key,T,Hash,KeyEqual,Allocator>::bucket
| size_type bucket( const Key& key ) const; |
(1) | (since C++11) |
template< typename K > size_type bucket( const K& x ) const; |
(2) | (since C++26) |
Hash and KeyEqual are both transparent. This assumes that such Hash is callable with both K and Key type, and that the KeyEqual is transparent, which, together, allows calling this function without constructing an instance of Key.The returned value is valid only for instances of the container for which bucket_count() returns the same value (e.g., rehash() invalidates previously obtained value).
The behavior is undefined if bucket_count() is zero.
Contents |
[edit] Parameters
| key | - | the value of the key to examine |
| x | - | a value of any type that can be transparently compared with a key |
[edit] Return value
Bucket index for the requested key.
[edit] Complexity
Constant.
[edit] Notes
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_associative_heterogeneous_insertion |
202311L |
(C++26) | Heterogeneous overloads for the remaining member functions in ordered and unordered associative containers. (2) |
[edit] Example
| This section is incomplete Reason: no example |
[edit] See also
| returns the number of elements in specific bucket (public member function) |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
