220 23723 <2BCBD0F7-9AD8-4CF1-AEBC-184DD56DBA5A@gmail.com> article
Path: news.gmane.org!not-for-mail
From: Howard Hinnant <howard.hinnant@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Default swap/hash_value
Date: Thu, 14 Jan 2016 14:03:27 -0500
Lines: 68
Approved: news@gmane.org
Message-ID: <2BCBD0F7-9AD8-4CF1-AEBC-184DD56DBA5A@gmail.com>
References: <569582E5.1040108@wanadoo.fr> <4072A7C6-B09D-4847-971B-2914643B91D7@gmail.com> <569594AD.6000505@wanadoo.fr> <2170C30C-830F-47C2-8397-29DD4ED35E97@gmail.com> <56960730.9000403@wanadoo.fr> <9160999F-C7E2-4D3F-B343-96CF587BEF61@gmail.com> <5696CC0A.5040709@wanadoo.fr> <753EF830-97D0-4653-B056-BDB2CD4B0760@gmail.com> <601027C6-EDBF-42C5-9AAB-766B31945702@gmail.com> <B59AADD0-1021-4DF9-8360-44C6EE3500E6@gmail.com> <5697EA27.7090603@wanadoo.fr>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\))
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: ger.gmane.org 1452798219 11618 80.91.229.3 (14 Jan 2016 19:03:39 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 14 Jan 2016 19:03:39 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCK2HM4L6YERBAXC362AKGQE5TGY7QQ@isocpp.org Thu Jan 14 20:03:33 2016
Return-path: <std-proposals+bncBCK2HM4L6YERBAXC362AKGQE5TGY7QQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f71.google.com ([209.85.220.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCK2HM4L6YERBAXC362AKGQE5TGY7QQ@isocpp.org>)
	id 1aJnBE-0004x3-GB
	for gclcip-std-proposals@m.gmane.org; Thu, 14 Jan 2016 20:03:32 +0100
Original-Received: by mail-pa0-f71.google.com with SMTP id a20sf313311384pag.3
        for <gclcip-std-proposals@m.gmane.org>; Thu, 14 Jan 2016 11:03:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=content-type:mime-version:subject:from:in-reply-to:date
         :content-transfer-encoding:message-id:references:to
         :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=sHlqDNPRDtTa3C845ephMGOZSdwzeZrvVwEbibQmOwA=;
        b=ufrQVU9waqNmvYzHUcDNkm2Kb7pi+X4pN1XzzFrTUgXok5zHoDT79zRyIgsFma75CI
         AwQoztGEEPK5KhtwCENvX6URetvTNssc5Xp+IHL3p+WvzYvdTlPpmigA3rqfI7a7dTCp
         VtPBZ9t2g0PQiFc5oJ4ohJqOPl+Q8JmzL3pMleFMVo+543Y/ayzXfjCCN+0liF7JGZH+
         H3d+FsbtPUTR58oUS7rr6GYOzNwbl4TQ7PDewr3h9x6z+DLzKUyt/1SVL/1zbr/2FPlx
         +YQfS2oPKS31+v+N8I4mkk1xo7Y301XvTZsswPtdLoovrPNUtRRpG3dt7w5pjoh/ptZz
    
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:content-type:mime-version:subject:from
         :in-reply-to:date:content-transfer-encoding:message-id:references:to
         :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=sHlqDNPRDtTa3C845ephMGOZSdwzeZrvVwEbibQmOwA=;
        b=Z4MztFg/E5a1QC1D9wKHXFGJF6k3IDJ22yyRU5HAdynpMbf/e4RLbD1ytasEKZXWg2
         nv4n8HNM3RxCZbFFBB4GH+sNzuSEeoMa4/2Yamyv5v/jQWJJw7MmfGLVfPVGHDXllkNq
         brE4PkozYvBwaiVkVtf92oGC0YbguSU1aiC3SUlVRx5s77A9FBrU7Y21ny7g6OusJb7T
         K1S4jlLchFwtD0WrbIJZU1Z7GhCfT04VvJamktF0SCvJ5XCnO4YuLpuXGOoBpzcxjIKL
         mqLS463d3d7Ac+7Zt31tZCs6XY/TMZxOAcG4h/hQRI6FfI9Biy2lEwjnem4TnFG+OyVx 
X-Gm-Message-State: ALoCoQnj/uKGNzLDeQIVleKkOUcgRTZwNpw64OpHLkXe3R99qZTjhdpEePFtAxAUhDFLjzgL2zcbOPt8QmyYcxNSIHrnQQ/yqQ==
X-Received: by 10.98.79.143 with SMTP id f15mr5052736pfj.6.1452798211382;
        Thu, 14 Jan 2016 11:03:31 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.96.72 with SMTP id j66ls610591qge.88.gmail; Thu, 14 Jan
 2016 11:03:29 -0800 (PST)
X-Received: by 10.140.18.167 with SMTP id 36mr8139391qgf.38.1452798209712;
        Thu, 14 Jan 2016 11:03:29 -0800 (PST)
Original-Received: from mail-qg0-x235.google.com (mail-qg0-x235.google.com. [2607:f8b0:400d:c04::235])
        by mx.google.com with ESMTPS id r71si8660859qha.23.2016.01.14.11.03.29
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 14 Jan 2016 11:03:29 -0800 (PST)
Received-SPF: pass (google.com: domain of howard.hinnant@gmail.com designates 2607:f8b0:400d:c04::235 as permitted sender) client-ip=2607:f8b0:400d:c04::235;
Original-Received: by mail-qg0-x235.google.com with SMTP id b35so360367387qge.0
        for <std-proposals@isocpp.org>; Thu, 14 Jan 2016 11:03:29 -0800 (PST)
X-Received: by 10.140.108.8 with SMTP id i8mr7876671qgf.83.1452798209504;
        Thu, 14 Jan 2016 11:03:29 -0800 (PST)
Original-Received: from [10.0.1.2] (cpe-104-229-168-124.twcny.res.rr.com. [104.229.168.124])
        by smtp.gmail.com with ESMTPSA id 140sm2983274qhm.10.2016.01.14.11.03.28
        for <std-proposals@isocpp.org>
        (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
        Thu, 14 Jan 2016 11:03:28 -0800 (PST)
In-Reply-To: <5697EA27.7090603@wanadoo.fr>
X-Mailer: Apple Mail (2.3112)
X-Original-Sender: howard.hinnant@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of howard.hinnant@gmail.com designates 2607:f8b0:400d:c04::235 as
 permitted sender) smtp.mailfrom=howard.hinnant@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
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:23723
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/23723>

On Jan 14, 2016, at 1:34 PM, Vicente J. Botet Escriba <vicente.botet@wanado=
o.fr> wrote:
>=20
> Le 14/01/2016 18:47, Howard Hinnant a =C3=A9crit :
>> On Jan 14, 2016, at 12:43 PM, Jonathan Coe <jonathanbcoe@gmail.com> wrot=
e:
>>> How will is_uniquely_represented work with architecture dependant align=
ment requirements and padding?
>> It will have to be up to the author of the type to correctly specialize =
is_uniquely_represented for all architectures of interest to them.  Padding=
 bytes can be detected by assuring that the sum of the size of your bases a=
nd members is equal to the size of your type.  For example:
>>=20
>> https://github.com/HowardHinnant/hash_append/blob/master/hash_append.h#L=
143-L151
>>=20
>>=20
> Howard. I don't see why the author should be the single one able to do it=
 correctly. Do you see a case for classes like std::pair for which the spec=
ialization your showed is not a good one?

No, I think the std::pair specialization should be fine for all cases, with=
 the possible exception of if someone specialized pair itself.  But I=E2=80=
=99ve never seen a motivating use case to specialize pair itself, and I wou=
ld likely reject any such code in a code review.

I may not be stating my position clearly.  My position is that given some u=
ser-defined class X:

class X
{
   std::size_t x_;
   std::size_t y_;
public:
   friend bool operator=3D(const X&, const X&);
};

I see no way to automatically do anything other than claim X is *not* uniqu=
ely represented, but of course allow the author of X to say otherwise.  Tha=
t being said, if we has this instead:

class X
{
   std::size_t x_;
   std::size_t y_;
public:
   friend bool operator=3D(const X&, const X&) =3D default;
};

Then I might get talked into believing that it would be safe for the compil=
er/std::lib to declare X uniquely represented.  For this second case I have=
n=E2=80=99t given it enough thought to be positive one way or the other.

Howard

PS:  I agree that it will be less problematic to split this proposal.

--=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/.

.
