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.

2686. Why isstd::hash specialized forerror_code, but noterror_condition?

Section: 19.5.2[system.error.syn]Status:C++17Submitter: Tim SongOpened: 2016-05-03Last modified: 2021-06-06

Priority:3

View all otherissues in [system.error.syn].

View all issues withC++17 status.

Discussion:

Botherror_code anderror_condition have anoperator< overload,enabling their use in associative containers without having to write a custom comparator.

However, onlyerror_code has astd::hashspecialization. So it's possible to have aset<error_code>, aset<error_condition>,anunordered_set<error_code>, but not anunordered_set<error_condition>. This seems...odd.

[2016-08 - Chicago]

Thurs AM: Moved to Tentatively Ready

Proposed resolution:

This wording is relative to N4582.

  1. Edit [system_error.syn], header<system_error> synopsis, as indicated:

    namespace std {    // ...    // 19.5.6 Hash support    template<class T> struct hash;    template<> struct hash<error_code>;template<> struct hash<error_condition>;   // ...}
  2. Edit 19.5.7[syserr.hash] as indicated:

    template <> struct hash<error_code>;template <> struct hash<error_condition>;

    -1- The template specializations shall meet the requirements of class templatehash (20.12.14).


[8]ページ先頭

©2009-2026 Movatter.jp