Created on 2009-03-19.00:00:00 last changed 171 months ago
Proposed resolution:
[To the editor: This resolution is merge-compatible to the resolution of 1078]
In [function.objects]/2, header <functional> synopsis, change as indicated:
// 20.6.17, hash function base template: template <ReferentType T> struct hash; // undefined
In [unord.hash]/1 change as indicated:
namespace std {template <class T> struct hash : public std::unary_function<T, std::size_t> { std::size_t operator()(T val) const; };template <ReferentType T> struct hash; // undefined }
In [unord.hash]/2 change as indicated:
-2- For all library-provided specializations, the template instantiation hash<T> shall provide a public operator() with return type std::size_t to satisfy the concept requirement Callable<const hash<T>, const T&>. If T is an object type or reference to object, hash<T> shall be publicly derived from std::unary_function<T, std::size_t>. The return value of operator() is unspecified, except that equal arguments shall yield the same result. operator() shall not throw exceptions.
In [support.rtti]/1, header <typeinfo> synopsis change as indicated:
namespace std { class type_info; class type_index; template <classReferentType T> struct hash;
[ Batavia (2009-05): ]
Alisdair is not certain that Daniel's proposed resolution is sufficient, and recommends we leave the hash template unconstrained for now.
Recommend that the Project Editor make the constrained declaration consistent with the definition in order to make the Working Paper internally consistent, and that the issue then be revisited.
Move to Open.
[ 2009-03-22 Daniel provided wording. ]
Is std::hash a constrained template or not?
According to class template hash [unord.hash], the definition is:
template <class T> struct hash : public std::unary_function<T, std::size_t> { std::size_t operator()(T val) const; };
And so unconstrained.
According to the <functional> synopsis in p2 Function objects [function.objects] the template is declared as:
template <ReferentType T> struct hash;
which would make hash a constrained template.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg591 |
2010-10-21 18:28:33 | admin | set | messages: + msg590 |
2010-10-21 18:28:33 | admin | set | messages: + msg589 |
2009-03-19 00:00:00 | admin | create |