Created on 2012-03-18.00:00:00 last changed 131 months ago
Proposed resolution:
This wording is relative to N3376.
Modify the class type_index synopsis, [type.index.overview] as indicated:
namespace std { class type_index { public: type_index(const type_info& rhs) noexcept; bool operator==(const type_index& rhs) const noexcept; bool operator!=(const type_index& rhs) const noexcept; bool operator< (const type_index& rhs) const noexcept; bool operator<= (const type_index& rhs) const noexcept; bool operator> (const type_index& rhs) const noexcept; bool operator>= (const type_index& rhs) const noexcept; size_t hash_code() const noexcept; const char* name() const noexcept; private: const type_info* target; // exposition only // Note that the use of a pointer here, rather than a reference, // means that the default copy/move constructor and assignment // operators will be provided and work as expected. }; }
Modify the prototype definitions in [type.index.members] as indicated:
size_t hash_code() const noexcept;-8- Returns: target->hash_code()
const char* name() const noexcept;-9- Returns: target->name()
[ 2013-04-20 Bristol ]
[ 2013-03-15 Issues Teleconference ]
Moved to Tentatively Ready.
The class type type_index is a thin wrapper of type_info to adapt it as a valid associative container element. Similar to type_info, all member functions have an effective noexcept(true) specification, with the exception of hash_code() and name(). The actual effects of these functions is a direct call to type_info's hash_code() and name function, but according to [support.rtti] these are both noexcept functions, so there is no reason for not declaring them as noexcept, too. In fact, one of the suggested changes of the original proposing paper N2530 specifically was to ensure that type_info would get a hash_code() function that guarantees not to throw exceptions (during that time the hash requirements did not allow to exit with an exception). From this we can conclude that type_index::hash_code() was intended to be nothrow.
It seems both consistent and technically simply to require these functions to be noexcept.History | |||
---|---|---|---|
Date | User | Action | Args |
2014-02-20 13:20:35 | admin | set | status: wp -> c++14 |
2013-04-25 19:07:07 | admin | set | status: voting -> wp |
2013-04-19 22:36:19 | admin | set | messages: + msg6480 |
2013-04-19 22:36:19 | admin | set | status: ready -> voting |
2013-03-18 14:33:00 | admin | set | messages: + msg6405 |
2013-03-18 13:02:36 | admin | set | status: new -> ready |
2012-03-18 17:45:00 | admin | set | messages: + msg6066 |
2012-03-18 00:00:00 | admin | create |