220 38672 <60dffd75-ebc3-4e4c-8666-f304be8f6136@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: m.cencora@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Three way comparison of arrays
Date: Fri, 15 Jun 2018 11:45:33 -0700 (PDT)
Lines: 143
Approved: news@gmane.org
Message-ID: <60dffd75-ebc3-4e4c-8666-f304be8f6136@isocpp.org>
References: <d50deead-c460-414b-b356-a398772b8f69@isocpp.org>
 <9c6a84e4-66a2-4a25-8372-c7a6c7b8de25@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_8599_1168304985.1529088333500"
X-Trace: blaine.gmane.org 1529088209 19085 195.159.176.226 (15 Jun 2018 18:43:29 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 15 Jun 2018 18:43:29 +0000 (UTC)
Cc: m.cencora@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBD7YFUMJRYMBBTUSSDMQKGQEPR4B44Y@isocpp.org Fri Jun 15 20:43:25 2018
Return-path: <std-proposals+bncBD7YFUMJRYMBBTUSSDMQKGQEPR4B44Y@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f200.google.com ([209.85.213.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBD7YFUMJRYMBBTUSSDMQKGQEPR4B44Y@isocpp.org>)
	id 1fTtgy-0004pK-Mj
	for gclcip-std-proposals@m.gmane.org; Fri, 15 Jun 2018 20:43:24 +0200
Original-Received: by mail-yb0-f200.google.com with SMTP id h29-v6sf7174554ybj.22
        for <gclcip-std-proposals@m.gmane.org>; Fri, 15 Jun 2018 11:45:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=Y1WZYJaAtAmr/dGUxbRJNsn2WPah9vu/kdRLyVIkAMk=;
        b=ACo4d/7Zx+DxZuLS2/0LrVHCKa0uVfi/BPBlFqnYAiijNWePMybyuiIQV+N1J3KrM4
         oWbxjNySNuDwlO1D1nz6S1rTZm29J8txS0E/aMGxYmLjfKaXTRpnPNi347daG6bJqyVu
         3xQLuoGJh9dO2rF+6SWpwC0zRyq6BduCRCR8hPhpFGWj/crEmiHc1xLVVi6qxxPJUNcn
         jnJEY75VqqNJVGZGKd+jaRy0GsxZLs5LLXOYH0zSg/cDJejm5xXYkz5Oq8n+I/BJsaTx
         q6wM74iKeZ4dFU94zjkTPShd8QAFSpPv4nfM7wx6O6y1UIRmJNcHCIxAYlYa9TB3fkLe
         pYgQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=Y1WZYJaAtAmr/dGUxbRJNsn2WPah9vu/kdRLyVIkAMk=;
        b=hK8TqfZCTHq3HiLN1CeB2cN0+fahjXdqN5D0rejNZ5sHr5nT6R5gR/1b05PDzVhZl3
         GHBMoUZfeRCIazz08t6OFkX5NtHfvLUivGMZSUnwcmhTWYs4pfZRYlLBEmtgrNb4TXpZ
         EzD4mrn/6At5OwUvkQ7z5gtJbfhvFVdo4UtRJ0rJbq/gydeRCrB734jnAGZJbiL3uh0C
         tmJg+F7OoCNBE9XPHmuM6+x9++gjNj8VumsK4djzcpqavCfxLApysPeb4CUWOVw/U90O
         /aQwMrY2Qlbms+coUCW9RORHQAoUcZ0mgeH2hVmtcX/1kckZOOUir17GQ0uRjqnWxHi9
         F8+A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=Y1WZYJaAtAmr/dGUxbRJNsn2WPah9vu/kdRLyVIkAMk=;
        b=eIOe/kjH3NnjVppFgxHVH8ZMUXWhevw3zLfYEOzyxIT0yQnRXfzC+243I3oCQlryhP
         1b149kiiTy1L/jTSAJS18Xa5bid1Y+u7F2Qq8irlocFowchkIdOTPhyJ+1zz79C1nZYr
         j8eTKUEalgm3DgGmuq/zR9L3DEECCK/UJnmROBeAgLWLVM4eTGy5n+Z16n2k3RN6RHQ7
         OWNv09GW6g81AfyCRCrHKDbezxtukPT2QPLojdsizxziZXbjxZW+HEqZHeOcN6gmzOmm
         ACTuSFGJa9sujVjHbOmmbXxLmccGFy50spdNn3lotC3ePsKhJ9/nHjUtq5lTFHIxT4uV
         UmdA==
X-Gm-Message-State: APt69E1lygTOJ3kj1erUMKHvhxZtpJqIK2hIhH7KYxQGCgHG++Y//dYE
	bgSPwvEX/O70siojnh2GjO2cBg==
X-Google-Smtp-Source: ADUXVKLIF2Yo+CchmoC5Zu0kmqMyLjUdbm5MqLif9nbozkJmRJDnAiFPrvbiTYccsHlfoM1tIzXezQ==
X-Received: by 2002:a25:d696:: with SMTP id n144-v6mr781134ybg.16.1529088335700;
        Fri, 15 Jun 2018 11:45:35 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a5b:4c6:: with SMTP id u6-v6ls665783ybp.19.gmail; Fri, 15
 Jun 2018 11:45:34 -0700 (PDT)
X-Received: by 2002:a25:4296:: with SMTP id p144-v6mr129291yba.3.1529088334176;
        Fri, 15 Jun 2018 11:45:34 -0700 (PDT)
In-Reply-To: <9c6a84e4-66a2-4a25-8372-c7a6c7b8de25@isocpp.org>
X-Original-Sender: m.cencora@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:38672
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38672>

------=_Part_8599_1168304985.1529088333500
Content-Type: multipart/alternative; 
	boundary="----=_Part_8600_1995088722.1529088333500"

------=_Part_8600_1995088722.1529088333500
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

This is a weak argument. We sacrifice the consistency of the operator<=3D>=
=20
(works for all types) for doubtful consistency of copy and compare (of a=20
single type). We should be fixing language corner cases so it does what=20
programmer intents.
So I'd rather have operator<=3D> for arrays in all cases, and fix array=20
copying as well.

Regards,
Maciej
=20
W dniu pi=C4=85tek, 15 czerwca 2018 19:45:12 UTC+2 u=C5=BCytkownik Barry Re=
vzin=20
napisa=C5=82:
>
>
>
> On Friday, June 15, 2018 at 10:34:10 AM UTC-5, m.ce...@gmail.com wrote:
>>
>> Hi,
>>
>> can we finally write idiomatic comparison code for arrays with three way=
=20
>> compare?
>>
>> bool foo()
>> {
>>     int a1[4] =3D { 1, 2, 3, 4 }, a2[4] =3D { 1, 2, 3, 4 };
>>     return (a1 <=3D> a2) =3D=3D 0;
>> }
>>
>>
>>
> No. This is explicitly rejected by design. Quoting from =20
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0515r3.pdf:
>
> For arrays, we don=E2=80=99t provide comparison if the array is not copya=
ble in=20
>> the language, to keep copying and comparison consistent. Note that for t=
wo=20
>> arrays, arr1<=3D>arr2 is ill-formed because the array-to-pointer convers=
ion=20
>> is not applied
>>
>
> Additionally, in Rapperswil, the two-way comparisons between arrays (i.e.=
=20
> a1 =3D=3D a2) were deprecated. So now at least they both consistently wil=
l not=20
> work.=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/60dffd75-ebc3-4e4c-8666-f304be8f6136%40isocpp.or=
g.

------=_Part_8600_1995088722.1529088333500
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>This is a weak argument. We sacrifice the consistency=
 of the operator&lt;=3D&gt; (works for all types) for doubtful consistency =
of copy and compare (of a single type). We should be fixing language corner=
 cases so it does what programmer intents.</div><div>So I&#39;d rather have=
 operator&lt;=3D&gt; for arrays in all cases, and fix array copying as well=
..<br></div><div><br></div><div>Regards,</div><div>Maciej<br></div>=C2=A0<br=
>W dniu pi=C4=85tek, 15 czerwca 2018 19:45:12 UTC+2 u=C5=BCytkownik Barry R=
evzin napisa=C5=82:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr"><br><br>On Friday, June 15, 2018 at 10:34:10 AM UTC-5, <a>m.ce...@gma=
il.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin=
-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">H=
i,<div><br></div><div>can we finally write idiomatic comparison code for ar=
rays with three way compare?</div><div><br></div><div><div style=3D"backgro=
und-color:rgb(255,255,254)"><div><font color=3D"#0000ff">bool=C2=A0</font><=
font color=3D"#000000">foo()</font></div><div style=3D"color:rgb(0,0,0)">{<=
/div><div style=3D"color:rgb(0,0,0)">    <span style=3D"color:#0000ff">=C2=
=A0 =C2=A0 int</span> a1[<span style=3D"color:#09885a">4</span>] =3D { <spa=
n style=3D"color:#09885a">1</span>, <span style=3D"color:#09885a">2</span>,=
 <span style=3D"color:#09885a">3</span>, <span style=3D"color:#09885a">4</s=
pan> }, a2[<span style=3D"color:#09885a">4</span>] =3D { <span style=3D"col=
or:#09885a">1</span>, <span style=3D"color:#09885a">2</span>, <span style=
=3D"color:#09885a">3</span>, <span style=3D"color:#09885a">4</span> };</div=
><div style=3D"color:rgb(0,0,0)">    <span style=3D"color:#0000ff">=C2=A0 =
=C2=A0 return</span> (a1 &lt;=3D&gt; a2) =3D=3D <span style=3D"color:#09885=
a">0</span>;</div><div style=3D"color:rgb(0,0,0)">}</div><div style=3D"colo=
r:rgb(0,0,0)"><br></div><div style=3D"color:rgb(0,0,0)"><br></div></div></d=
iv></div></blockquote><div><br></div><div>No. This is explicitly rejected b=
y design. Quoting from=C2=A0=C2=A0<a href=3D"http://www.open-std.org/jtc1/s=
c22/wg21/docs/papers/2017/p0515r3.pdf" target=3D"_blank" rel=3D"nofollow" o=
nmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2F=
www.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0515r3.pdf\=
x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE77LL7r0jtq9n03x87nNQbgz16aQ&#39;;r=
eturn true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhtt=
p%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0=
515r3.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE77LL7r0jtq9n03x87nNQbgz1=
6aQ&#39;;return true;">http://www.open-std.org/<wbr>jtc1/sc22/wg21/docs/pap=
ers/<wbr>2017/p0515r3.pdf</a>:</div><div><br></div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex">For arrays, we don=E2=80=99t provide comparison i=
f the array is not copyable in the language, to keep copying
and comparison consistent. Note that for two arrays, arr1&lt;=3D&gt;arr2 is=
 ill-formed because the array-to-pointer
conversion is not applied<br></blockquote><div><br></div><div>Additionally,=
 in Rapperswil, the two-way comparisons between arrays (i.e. a1 =3D=3D a2) =
were deprecated. So now at least they both consistently will not work.=C2=
=A0</div><div><br></div></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/60dffd75-ebc3-4e4c-8666-f304be8f6136%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/60dffd75-ebc3-4e4c-8666-f304be8f6136=
%40isocpp.org</a>.<br />

------=_Part_8600_1995088722.1529088333500--

------=_Part_8599_1168304985.1529088333500--

.
