Movatterモバイル変換


[0]ホーム

URL:



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

2119. Missinghash specializations for extended integer types

Section: 22.10.19[unord.hash]Status:C++17Submitter: Daniel KrüglerOpened: 2011-12-16Last modified: 2017-07-30

Priority:3

View all otherissues in [unord.hash].

View all issues withC++17 status.

Discussion:

According to the header<functional> synopsis 22.10[function.objects] and to the explicit description in 22.10.19[unord.hash] class templatehash specializations shall be provided for all arithmetic types that are not extended integer types. This is not explicitly mentioned, but neither the list nor any normative wording does include them, so it follows by implication.

What are the reasons that extended integer types are excluded? E.g. fornumeric_limits corresponding specializations are required. I would expect that anunordered_map with key typestd::uintmax_t would just work, but that depends now on whether this type is an extended integer type or not.

This issue isnot asking for also providing specializations for thecv-qualified arithmetic types. While this is surely a nice-to-have feature,I consider that restriction as a more secondary problem in practice.

The proposed resolution also fixes a problem mentioned in2109(i) in regardto confusing requirements on user-defined types and those on implementations.

[2012, Kona]

Move to Open.

Agreed that it's a real issue and that the proposed wording fixes it. However, the wordingchange is not minimal and isn't consistent with the way we fixed hash wording elsewhere.

Alisdair will provide updated wording.

[2014-05-06 Geoffrey Romer suggests alternative wording]

Previous resolution from Daniel [SUPERSEDED]:

This wording is relative to the FDIS.

Change 22.10.19[unord.hash] p2 as indicated:

template <> struct hash<bool>;template <> struct hash<char>;[…]template <> struct hash<long double>;template <class T> struct hash<T*>;

-2-Requires: the template specializations shall meet the requirements of class templatehash (22.10.19[unord.hash])The header<functional> provides definitions for specializations of thehash class template for eachcv-unqualified arithmetic type. This header also provides a definition for a partial specialization of thehash class template for any pointer type. The requirements for the members of these specializations are given in sub-clause 22.10.19[unord.hash].

[2015-05, Lenexa]

STL: the new PR is very simple and could resolve that nicely
MC: the older PR is rather longish

STL: I want to have Ready
MC: move to ready: in favor: 13, opposed: 0, abstain: 4

Proposed resolution:

This wording is relative to N3936.

Change 22.10.19[unord.hash] p1 as indicated:

The unordered associative containers defined in 23.5 use specializations of the class templatehash as thedefault hash function. For all object typesKey for which there exists a specializationhash<Key>, and for allintegral and enumeration types (7.2)Key, the instantiationhash<Key> shall: […]


[8]ページ先頭

©2009-2026 Movatter.jp