This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

1519. bucketsize() const only for unordered set

Section: 23.5.3 [unord.map], 23.5.4 [unord.multimap], 23.5.7 [unord.multiset] Status: C++11 Submitter: Nicolai Josuttis Opened: 2010-10-09 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [unord.map].

View all issues with C++11 status.

Discussion:

While bucket_size() is const for unordered_set, for all other unordered containers it is not defined as constant member function.

[ Post-Rapperswil ]

Moved to Tentatively Ready after 5 positive votes on c++std-lib.

[ Adopted at 2010-11 Batavia ]

Proposed resolution:

The wording refers to N3126.

  1. Change 23.7.1 Class template unordered_map [unord.map]/3, as indicated:
      namespace std {
        template <class Key,
          class T,
          class Hash = hash<Key>,
          class Pred = std::equal_to<Key>,
          class Alloc = std::allocator<std::pair<const Key, T> > >
        class unordered_map
        {
        public:
          [..]
          // bucket interface
          size_type bucket_count() const;
          size_type max_bucket_count() const;
          size_type bucket_size(size_type n) const;
          [..]
    
  2. Change 23.7.2 Class template unordered_multimap [unord.multimap]/3, as indicated:
      namespace std {
        template <class Key,
          class T,
          class Hash = hash<Key>,
          class Pred = std::equal_to<Key>,
          class Alloc = std::allocator<std::pair<const Key, T> > >
        class unordered_multimap
        {
        public:
          [..]
          // bucket interface
          size_type bucket_count() const;
          size_type max_bucket_count() const;
          size_type bucket_size(size_type n) const;
          [..]
    
  3. Change 23.7.4 Class template unordered_multiset [unord.multiset]/3, as indicated:
      namespace std {
        template <class Key,
          class Hash = hash<Key>,
          class Pred = std::equal_to<Key>,
          class Alloc = std::allocator<Key> >
        class unordered_multiset
        {
        public:
          [..]
          // bucket interface
          size_type bucket_count() const;
          size_type max_bucket_count() const;
          size_type bucket_size(size_type n) const;
          [..]