220 38671 <9c6a84e4-66a2-4a25-8372-c7a6c7b8de25@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Barry Revzin <barry.revzin@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Three way comparison of arrays
Date: Fri, 15 Jun 2018 10:45:12 -0700 (PDT)
Lines: 108
Approved: news@gmane.org
Message-ID: <9c6a84e4-66a2-4a25-8372-c7a6c7b8de25@isocpp.org>
References: <d50deead-c460-414b-b356-a398772b8f69@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_8245_117857566.1529084712130"
X-Trace: blaine.gmane.org 1529084588 27036 195.159.176.226 (15 Jun 2018 17:43:08 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 15 Jun 2018 17:43:08 +0000 (UTC)
Cc: m.cencora@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCJJTG7CS4ARBKPWR7MQKGQE7A2LOHA@isocpp.org Fri Jun 15 19:43:04 2018
Return-path: <std-proposals+bncBCJJTG7CS4ARBKPWR7MQKGQE7A2LOHA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f198.google.com ([209.85.213.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCJJTG7CS4ARBKPWR7MQKGQE7A2LOHA@isocpp.org>)
	id 1fTskZ-0006v3-RK
	for gclcip-std-proposals@m.gmane.org; Fri, 15 Jun 2018 19:43:03 +0200
Original-Received: by mail-yb0-f198.google.com with SMTP id x134-v6sf7360549ybg.2
        for <gclcip-std-proposals@m.gmane.org>; Fri, 15 Jun 2018 10:45:14 -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=FIdZEm7OjbZEDnx0/R+ICwKYIWAS2UmGTEsWex4p0Wo=;
        b=Zb0/woqKxrMuhBxgk1xtT+glXeqsbOWe5an04pR0EBM+tT0oghd01YLus2WzX88XSX
         HgBNs/DEQ0ySIS9TVrReVqG5Q9/RVJwpoS6S2lMu2b8w0bFzvP1ZrgJ1gvil247DZW6j
         dWD4L50EbtH6/DyNbCPOHHBySLHq8WRSIOAz6hGtjx48BXZeR0MSCi2kyHIyWTlkeXF3
         WyXYtVE5GaZKqrA6MogDvxRWON91AGB8AynKRcJCYAjydnh0HHXAAtMuC98AQIC57n6S
         OWBzwXhOS03AEH2lO4YxB2Y88GhmmqZenUEyXHeYFUXbgElXc8ely64tTz0B31KLEcgC
         f7dg==
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=FIdZEm7OjbZEDnx0/R+ICwKYIWAS2UmGTEsWex4p0Wo=;
        b=lw2u8ED5KnlxbtZ4/qFcWdRRvSOXXRr/Np66R+rgX9dWGnlE1mXpu8KIRrSVYqzyVs
         5Rbmqi8PKPBaAEa/jodKKCkyRqZ05Qg5GAQRxJ1BBhxcCX15wBvjS1Ad9XaInuPyB6Qa
         k4NS4uq5xWv3mmg+rIVemELfNJAxGgrLdOK6b0KR5RAWkQREbO0RXSvdtPilHtS//luQ
         Y9B84/Lm6HwgXQesRn84lmSI6Oab7qMLK+3sdhjVRc+BnU4EHRCaGAi1MwCCTUJuk6Fy
         ITct4Z0Y3lfiWCOedm2ofSUD3ctSLycBu7V/32v9too73tDoYVFBPfZh6/6N6YAkYIHf
         DCkQ==
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=FIdZEm7OjbZEDnx0/R+ICwKYIWAS2UmGTEsWex4p0Wo=;
        b=qxuzpp8Goo3iKMwFtltfRnxl40dqeRAEUz/v5QK9dDQR+GE33VISsYvv05csVovqn/
         kXmh8TjKyG9fmQkLNN5gTxEpdwWKHSbQFfAqx62PJnFvBcQKiJ9AVMYXYtvIi1UcODSK
         GG9baMjL8uKRcAi5NO8snH8Rn29Qhl3p5TQ1k1AUMPz/7OcI0CWg+HezkPFVLtFNhTgY
         YhiZLtRIuM4SKQdZo2Qaugi5lXwmlxafxts2mibquaa7wzS2cnSwqcOYE0ru9gTk/g88
         JOpZU6iVqOUUySyWE2FIs1zYfHmcq5d13x4TGiPX/ApW77IcLVwkuAyf84LNgqYE1v1r
         lCIQ==
X-Gm-Message-State: APt69E2myePEP/YOB7ckrJU33b4LPX01Eu715d3BD+WjavZNGcL8wIyj
	6P1vy+hoHuH0EXAinVxdRWiqvQ==
X-Google-Smtp-Source: ADUXVKKnVeUmBQG2jzPeaELaPL/qnYTyzG1rZNhyQ2We8cMy7wGksWkCfxjQLVcUWsYiFBrvLAwyJA==
X-Received: by 2002:a81:5ed4:: with SMTP id s203-v6mr737522ywb.73.1529084714342;
        Fri, 15 Jun 2018 10:45:14 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:4c89:: with SMTP id z131-v6ls1510502ywa.14.gmail; Fri,
 15 Jun 2018 10:45:13 -0700 (PDT)
X-Received: by 2002:a81:7a10:: with SMTP id v16-v6mr113024ywc.3.1529084713006;
        Fri, 15 Jun 2018 10:45:13 -0700 (PDT)
In-Reply-To: <d50deead-c460-414b-b356-a398772b8f69@isocpp.org>
X-Original-Sender: Barry.Revzin@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:38671
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38671>

------=_Part_8245_117857566.1529084712130
Content-Type: multipart/alternative; 
	boundary="----=_Part_8246_1425871839.1529084712130"

------=_Part_8246_1425871839.1529084712130
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



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=20
from  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 copyabl=
e in the=20
> language, to keep copying and comparison consistent. Note that for two=20
> arrays, arr1<=3D>arr2 is ill-formed because the array-to-pointer conversi=
on=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 will =
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/9c6a84e4-66a2-4a25-8372-c7a6c7b8de25%40isocpp.or=
g.

------=_Part_8246_1425871839.1529084712130
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, June 15, 2018 at 10:34:10 AM UTC-5, m.c=
e...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">Hi,<div><br></div><div>can we finally write idiomatic comparison c=
ode for arrays with three way compare?</div><div><br></div><div><div style=
=3D"background-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:#0=
000ff">=C2=A0 =C2=A0 int</span> a1[<span style=3D"color:#09885a">4</span>] =
=3D { <span style=3D"color:#09885a">1</span>, <span style=3D"color:#09885a"=
>2</span>, <span style=3D"color:#09885a">3</span>, <span style=3D"color:#09=
885a">4</span> }, a2[<span style=3D"color:#09885a">4</span>] =3D { <span st=
yle=3D"color:#09885a">1</span>, <span style=3D"color:#09885a">2</span>, <sp=
an 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=
:#09885a">0</span>;</div><div style=3D"color:rgb(0,0,0)">}</div><div style=
=3D"color:rgb(0,0,0)"><br></div><div style=3D"color:rgb(0,0,0)"><br></div><=
/div></div></div></blockquote><div><br></div><div>No. This is explicitly re=
jected by design. Quoting from=C2=A0=C2=A0http://www.open-std.org/jtc1/sc22=
/wg21/docs/papers/2017/p0515r3.pdf:</div><div><br></div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid=
 rgb(204, 204, 204); padding-left: 1ex;">For arrays, we don=E2=80=99t provi=
de comparison if 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>

<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/9c6a84e4-66a2-4a25-8372-c7a6c7b8de25%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/9c6a84e4-66a2-4a25-8372-c7a6c7b8de25=
%40isocpp.org</a>.<br />

------=_Part_8246_1425871839.1529084712130--

------=_Part_8245_117857566.1529084712130--

.
