220 23697 <56960730.9000403@wanadoo.fr> article
Path: news.gmane.org!not-for-mail
From: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Default swap/hash_value
Date: Wed, 13 Jan 2016 09:13:36 +0100
Lines: 64
Approved: news@gmane.org
Message-ID: <56960730.9000403@wanadoo.fr>
References: <569582E5.1040108@wanadoo.fr>
 <4072A7C6-B09D-4847-971B-2914643B91D7@gmail.com>
 <569594AD.6000505@wanadoo.fr>
 <2170C30C-830F-47C2-8397-29DD4ED35E97@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1452672827 10419 80.91.229.3 (13 Jan 2016 08:13:47 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 13 Jan 2016 08:13:47 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDH67CONY4PBBMMO3C2AKGQEEV7X3VY@isocpp.org Wed Jan 13 09:13:40 2016
Return-path: <std-proposals+bncBDH67CONY4PBBMMO3C2AKGQEEV7X3VY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lb0-f198.google.com ([209.85.217.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDH67CONY4PBBMMO3C2AKGQEEV7X3VY@isocpp.org>)
	id 1aJGYl-0003QL-46
	for gclcip-std-proposals@m.gmane.org; Wed, 13 Jan 2016 09:13:39 +0100
Original-Received: by mail-lb0-f198.google.com with SMTP id dx9sf16224723lbc.3
        for <gclcip-std-proposals@m.gmane.org>; Wed, 13 Jan 2016 00:13:38 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-to:content-type:content-transfer-encoding
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=mitR9r4pb9WutJbKTqszHvi1srG/ljCbE4wlSy01stk=;
        b=csYJLwD7X02HI98l6DRrO6WJmDvLH1JOkGe9La7vPJWDWRExVmCYtl9y8sbqoFil53
         NoCsp1w7L7UAqunMfSyMpbq2ADddTgPYcpJ4xblc/FlDK0+l1lI8A/NkBt2i+kKdefx4
         Lr0wVEy6O1NrAIU/psneXRNw+4+ostNOTnGEAb0v7AXxoVzlsDFwyjUfDGoJmqU55eqw
         wpcSG+ayN0celBOKDM8TTe8Q/3e/dUZOPstPH8ZMWeKxh+wJKvVMfamCF+cnz0WSVVgG
         p8vmovUrAQVTWGtNnrWKIM26vYKBG5yQDuRacyQHxEgz/K9k1fMZ6Bvx+K3gt 
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-to:content-type
         :content-transfer-encoding:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=mitR9r4pb9WutJbKTqszHvi1srG/ljCbE4wlSy01stk=;
        b=kPRgeXpb7TXmwU7s/e9QRbdRnag3IYuI9ZIDrLsw+TZ0h9iTiNEAdMQhgPPdXsvcva
         bGqkTuNGC2lguGWHMO84aFWYhIkmYyyjcHrJTpP+Hu59TCpicU2CAR+kTJgNg9PG3EQ0
         hEM639uXYRZ9IC2vAZvKZSK2M/74ZqUxjT3pYYZ6C+RCx96TZViMT8vDX9t3vXWMpYx6
         V7Cr2RBB+eKFCLRkjLQAkWzxYNATIHhwInXuJrDNlf5jhWpg536HT/MmAbd8I6Y/sle6
         72+4ZrKy38vq3HoYXGpGUWYNEkq4Fenkcgtfhupa4226vjN 
X-Gm-Message-State: ALoCoQmEsutxRK/0DF+oX+NJDxnbxXHhng/UquriKcjfxRw4PWZNuZFUMbkLP4kbVb2HO1CifSeMa+x5WYqGC4W29oHHas4J1g==
X-Received: by 10.112.162.101 with SMTP id xz5mr1060222lbb.20.1452672818481;
        Wed, 13 Jan 2016 00:13:38 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.4.74 with SMTP id 71ls781289wme.7.canary; Wed, 13 Jan 2016
 00:13:37 -0800 (PST)
X-Received: by 10.194.90.50 with SMTP id bt18mr144152383wjb.118.1452672817297;
        Wed, 13 Jan 2016 00:13:37 -0800 (PST)
Original-Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr. [80.12.242.123])
        by mx.google.com with ESMTPS id s140si37090138wmb.97.2016.01.13.00.13.37
        for <std-proposals@isocpp.org>
        (version=TLS1 cipher=AES128-SHA bits=128/128);
        Wed, 13 Jan 2016 00:13:37 -0800 (PST)
Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of vicente.botet@wanadoo.fr) client-ip=80.12.242.123;
Original-Received: from new-host.home ([86.214.79.135])
	by mwinf5d36 with ME
	id 5LDc1s00F2v9yza03LDcgP; Wed, 13 Jan 2016 09:13:37 +0100
X-ME-Helo: new-host.home
X-ME-Auth: dmljZW50ZS5ib3RldEB3YW5hZG9vLmZy
X-ME-Date: Wed, 13 Jan 2016 09:13:37 +0100
X-ME-IP: 86.214.79.135
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0)
 Gecko/20100101 Thunderbird/38.4.0
In-Reply-To: <2170C30C-830F-47C2-8397-29DD4ED35E97@gmail.com>
X-Original-Sender: vicente.botet@wanadoo.fr
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 80.12.242.123 is neither permitted nor denied by best guess
 record for domain of vicente.botet@wanadoo.fr) smtp.mailfrom=vicente.botet@wanadoo.fr
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:23697
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/23697>

Le 13/01/2016 01:48, Howard Hinnant a =C3=A9crit :
> On Jan 12, 2016, at 7:05 PM, Vicente J. Botet Escriba <vicente.botet@wana=
doo.fr> wrote:
>> I understand your concern, and I'm taking this in account as I'm suggest=
ing the generation of hash_value as defined in P0029R0.
> Thanks.
>
>> What am I missing?
>>
> P0029R0 was poorly written in that it did not emphasize this capability, =
even though it did include it.  In contrast, this was the entire point of N=
3980.
>
> In P0029R0-speak, std::hash_code *is* a hash algorithm.  It is just one h=
ash algorithm.  It is the hash algorithm supplied by the std::lib.  A type =
that is inspired only to operate with this single std::lib-supplied algorit=
hm implements:
>
>      std::hash_code hash_value(std::hash_code h, const Foo& foo)
>
> In contrast, (and still according to P0029R0), a type that wants to be ha=
shable by *any* hash algorithm *instead* implements:
>
>      template <typename H>
>          H hash_value(H h, const Foo& foo);
>
> The hash algorithm now is represented by the generic template parameter H=
..
>
> In 3980-speak, this was spelled:
>
>      template <class HashAlgorithm>
>          void hash_append(HashAlgorithm& h, T const& t);
>
> But the idea was similar.
>
>
I'll update the draft to signal that the proposed generation would need=20
to be adapted to the final composable hashing proposal and change the=20
example to make use of a template parameter H. What I'm interested in is=20
in knowing if the committee would be or not for this default definition.

I've some additional concerns about the possible generation of=20
specialization of is_uniquely_represented<T>. I would like it to be=20
generated the specialization when possible but while multiple definition=20
of hash_value could be check at link time, I believe that multiple=20
specializations of is_uniquely_represented<T> would result in ODR, which=20
would be a showstopper. So at the end, it would be the responsibility of=20
the developer of class C to add a specialization of=20
is_uniquely_represented<T>. What do you think about this point?

Vicente

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at https://groups.google.com/a/isocpp.org/group/std-propos=
als/.

.
