This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Default implementation of std::hash template


2013/3/6 Daniel Frey <d.frey@gmx.de>:
> On 06.03.2013, at 21:04, Jonathan Wakely wrote:
>
>> On 6 March 2013 19:13, Daniel Frey wrote:
>>>
>>> we can have both is_hashable and the static_assert, which fires if someone tries to instantiate the template:
>>>
>>>  std::unordered_set< std::pair< int, int > > dummy; // fires the static_assert.
>>>
>>> What do you think?
>>
>> On the trunk we just have an undefined primary template, there's no
>> static_assertion, and your trait works with GCC 4.8 (after adding the
>> missing closing parenthesis for the sizeof)
>
> Oh, that's good news! :)
>
> One question, if you allow: Was there some DR against the standard and is it now guaranteed that the primary template is undefined?

No, there is not. Implementations vary, e.g. the Dinkumware library
*defines* the primary template and uses this to provide a
specialization for enumeration types.

Note that there exists a related one, though:

http://cplusplus.github.com/LWG/lwg-active.html#2148

Because previously the standard was only speaking about the
specializations and there seemed to be no requirements for the primary
template whatsoever. And from what I've heard VC++ also has (had?) a
static_assert in place...
>

There is evidence for the idea that in the future the standard library
may define the primary hash template, referring via ADL to a free hash
function. This possibility shouldn't be excluded via strict wording at
this point of time that closes this path.

- Daniel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]