Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::unordered_multimap<Key,T,Hash,KeyEqual,Allocator>::bucket

      From cppreference.com
      <cpp‎ |container‎ |unordered multimap

      [edit template]
       
       
       
      std::unordered_multimap
      Member types
      Member functions
      Non-member functions
      Deduction guides(C++17)
       
      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)
      1) Returns the index of the bucket for keykey. Elements (if any) with keys equivalent tokey are always found in this bucket.
      2) Returns the index of the bucket for key that comparesequivalent to the valuex. Elements (if any) with keys that compare equivalent tox are always found in this bucket. This overload participates in overload resolution only ifHash andKeyEqual are bothtransparent. This assumes that suchHash is callable with bothK andKey type, and that theKeyEqual is transparent, which, together, allows calling this function without constructing an instance ofKey.

      The returned value is valid only for instances of the container for whichbucket_count() returns the same value (e.g.,rehash() invalidates previously obtained value).

      The behavior is undefined ifbucket_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 macroValueStdFeature
      __cpp_lib_associative_heterogeneous_insertion202311L(C++26)Heterogeneous overloads for the remaining member functions inordered andunordered associativecontainers.(2)

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      returns the number of elements in specific bucket
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/container/unordered_multimap/bucket&oldid=136078"

      [8]ページ先頭

      ©2009-2025 Movatter.jp