A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue2230 below:

"see below" for initializer-list constructors of unordered containers

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

2230. "see below" for initializer-list constructors of unordered containers

Section: 23.5 [unord] Status: C++17 Submitter: Jonathan Wakely Opened: 2013-01-06 Last modified: 2017-07-30

Priority: 4

View all other issues in [unord].

View all issues with C++17 status.

Discussion:

The unordered_map class definition in 23.5.3.1 [unord.map.overview] declares an initializer-list constructor that says "see below":

unordered_map(initializer_list<value_type>,
    size_type = see below,
    const hasher& hf = hasher(),
    const key_equal& eql = key_equal(),
    const allocator_type& a = allocator_type());

But that constructor isn't defined below. The same problem exists for the other unordered associative containers.

[2013-09 Chicago]

STL: ordered are also missing declarations, but issue is forthcoming

Walter: how does adding a signature address issue? — nevermind Jayson: in his wording, isn't he just dropping the size_type? Walter: partial fix is to introduce the name Stefanus: explanation of requiring name because of n buckets STL: solution for his issue satisfies both ordered and unordered and is simplier than provided wording STL: patches general table instead STL: proposes adding extra rows instead of extra declarations Stefanus: clarify n in the synopsis Walter: general rule, name is optional in declaration Stefanus: how to proceed Walter: significant overlap with forthcoming issue, suggestion to defer

[2014-02-20 Re-open Deferred issues as Priority 4]

[2014-03-27 Jonathan improves proposed wording]

[2014-05-20 STL and Jonathan communicate]

STL: With 2322(i) resolved, is there anything left for this issue to fix?

Jonathan: The synopsis still says "see below" and it's not immediately clear that "see below" means "see the definition of a different constructor, which defines the behaviour of this one due to a table defined much earlier".

[2014-05-23 Library reflector vote]

The issue has been identified as Tentatively Ready based on five votes in favour.

Proposed resolution:

This wording is relative to N3936.

  1. Edit 23.5.3.1 [unord.map.overview], class template unordered_map synopsis, as follows:

    […]
    unordered_map(initializer_list<value_type> il,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    […]
    
  2. Edit 23.5.3.2 [unord.map.cnstr] as follows:

    template <class InputIterator>
    unordered_map(InputIterator f, InputIterator l,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    unordered_map(initializer_list<value_type> il,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    

    -3- Effects: Constructs an empty unordered_map using the specified hash function, key equality function, and allocator, and using at least n buckets. If n is not provided, the number of buckets is implementation-defined. Then inserts elements from the range [f, l) for the first form, or from the range [il.begin(), il.end()) for the second form. max_load_factor() returns 1.0.

  3. Edit 23.5.4.1 [unord.multimap.overview], class template unordered_multimap synopsis, as follows:

    […]
    unordered_multimap(initializer_list<value_type> il,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    […]
    
  4. Edit 23.5.4.2 [unord.multimap.cnstr] as follows:

    template <class InputIterator>
    unordered_multimap(InputIterator f, InputIterator l,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    unordered_multimap(initializer_list<value_type> il,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    

    -3- Effects: Constructs an empty unordered_multimap using the specified hash function, key equality function, and allocator, and using at least n buckets. If n is not provided, the number of buckets is implementation-defined. Then inserts elements from the range [f, l) for the first form, or from the range [il.begin(), il.end()) for the second form. max_load_factor() returns 1.0.

  5. Edit 23.5.6.1 [unord.set.overview], class template unordered_set synopsis, as follows:

    […]
    unordered_set(initializer_list<value_type> il,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    […]
    
  6. Edit 23.5.6.2 [unord.set.cnstr] as follows:

    template <class InputIterator>
    unordered_set(InputIterator f, InputIterator l,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    unordered_set(initializer_list<value_type> il,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    

    -3- Effects: Constructs an empty unordered_set using the specified hash function, key equality function, and allocator, and using at least n buckets. If n is not provided, the number of buckets is implementation-defined. Then inserts elements from the range [f, l) for the first form, or from the range [il.begin(), il.end()) for the second form. max_load_factor() returns 1.0.

  7. Edit 23.5.7.1 [unord.multiset.overview], class template unordered_multiset synopsis, as follows:

    […]
    unordered_multiset(initializer_list<value_type> il,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    […]
    
  8. Edit 23.5.7.2 [unord.multiset.cnstr] as follows:

    template <class InputIterator>
    unordered_multiset(InputIterator f, InputIterator l,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    unordered_multiset(initializer_list<value_type> il,
      size_type n = see below,
      const hasher& hf = hasher(),
      const key_equal& eql = key_equal(),
      const allocator_type& a = allocator_type());
    

    -3- Effects: Constructs an empty unordered_multiset using the specified hash function, key equality function, and allocator, and using at least n buckets. If n is not provided, the number of buckets is implementation-defined. Then inserts elements from the range [f, l) for the first form, or from the range [il.begin(), il.end()) for the second form. max_load_factor() returns 1.0.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4