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: [v3 PATCH] Make poisoned hashes SFINAE away the call operator of the hash.


On 20 January 2017 at 17:27, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> On 20 January 2017 at 17:21, Jonathan Wakely <jwakely@redhat.com> wrote:
>> This part for std::unique_ptr is the only part that isn't C++17-only,
>> so this is the part I'm most nervous about. Given that we're in stage
>> 4 and this isn't even fixing something in Bugzilla (even if it is a
>> real bug), would it be possible to only fix optional and variant for
>> now? We could revisit the unique_ptr part once we know this approach
>> doesn't have some other problem that we haven't guessed yet.
>
> Sure. I would guesstimate that custom pointer types that aren't
> hashable should be rare,
> so hitting that problem is unlikely.
>
> I'll remove the unique_ptr bits, will give the deduced-bool a spin and
> fix the whitespace, and will then
> send a new patch for review.

Here:

2017-01-20  Ville Voutilainen  <ville.voutilainen@gmail.com>

2017-01-20  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Make poisoned hashes SFINAE away the call operator
    of the hash.
    * include/bits/functional_hash.h
    (__poison_hash::__enable_hash_call): New.
    * include/std/optional (__optional_hash_call_base): New.
    (hash<optional<_Tp>>): Derive from the new base,
    move the hash function into that base.
    * include/std/variant (__variant_hash_call_base_impl): New.
    (__variant_hash_call_base): Likewise.
    (hash<variant<_Types...>>): Derive from the new base,
    move the hash function into that base.
    * testsuite/20_util/optional/hash.cc: Add tests for is_callable.
    * testsuite/20_util/variant/hash.cc: Likewise.

Attachment: is_hash_callable_2.diff
Description: Text document


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