220 38670 <fb962daa-db76-4b9c-9697-7d734d327852@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 10:05:09 -0700 (PDT)
Lines: 197
Approved: news@gmane.org
Message-ID: <fb962daa-db76-4b9c-9697-7d734d327852@isocpp.org>
References: <d50deead-c460-414b-b356-a398772b8f69@isocpp.org>
 <CALvx3hZQ4CMYBRfaQegK64d2JzLk0LS8y3u04id0Arbrgo2WKg@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_8236_1239228492.1529082309693"
X-Trace: blaine.gmane.org 1529082185 11488 195.159.176.226 (15 Jun 2018 17:03:05 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 15 Jun 2018 17:03:05 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBD7YFUMJRYMBBRXDR7MQKGQEU6ENZHQ@isocpp.org Fri Jun 15 19:03:01 2018
Return-path: <std-proposals+bncBD7YFUMJRYMBBRXDR7MQKGQEU6ENZHQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f197.google.com ([209.85.161.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBD7YFUMJRYMBBRXDR7MQKGQEU6ENZHQ@isocpp.org>)
	id 1fTs7o-0002nV-K5
	for gclcip-std-proposals@m.gmane.org; Fri, 15 Jun 2018 19:03:00 +0200
Original-Received: by mail-yw0-f197.google.com with SMTP id w7-v6sf7751162ywf.1
        for <gclcip-std-proposals@m.gmane.org>; Fri, 15 Jun 2018 10:05:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to: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=bM5vRuD8cX9tNvavFt8JvH2ifQ6q53nN+9um2iGJrA8=;
        b=Er3l/L2XksApkksc+52eCrmZVJbRk1WKhb8WXyKL4z4+a09pxQxN9IWUVOiBNV4Nst
         ifo5o+XkL96mFNNsk8s9lqjkbftkPL6TeKMzwtSnU41R7fcz9dqm5VaNMM7qQYeFpnKw
         7TNdWO7/5+n2nxQgiPpTQLiglDze8sCznVfF5KUqq5Hy7r4qq5Nf0e3Z3mdyt9pd5nBQ
         yRN8MGAw9TZUVOvhOkjoQMmF9g4i29OGD7peOA+hqtSW8xNxiJPfCt7V9pQNP5E/7y8z
         VygH5qUbNCBvtxtZTSnHg4vbjqrP+/lvvpGskp0nH8/3BkoVrFyJH279UsAv3Hfcsije
         YYpw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to: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=bM5vRuD8cX9tNvavFt8JvH2ifQ6q53nN+9um2iGJrA8=;
        b=aYwqnikCBWfkFKA4ek7tsV3jCf6K1Pnpyo3j+v58o0Uotfnao91OJfquOgdzPmyDD6
         cPomjMADGyRhtDA6wsFQn4sj3RgS8kyTDXDx6n9vUVfVmhuq+C4V+4JG9suAyiU6SkCB
         /xjupQc/KiI9PejBbvsRvXWGFV/g+O0iXJvKHrGbNL0pwnEMQROiQEdFlV2QxMyb3GhA
         pD3f79cBAYyvi105RB1wPb2u/nfAY0hxRnA/BTrK5rMt39kvoQuc+okuOxXGcjwVeI2U
         wbhXymawoLGsN1J+F+R+QpUDW7JWmhoDIpj/IeLpNW6m+OiBt/9JP6etlhm9411G9RMj
         +ZKQ==
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: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=bM5vRuD8cX9tNvavFt8JvH2ifQ6q53nN+9um2iGJrA8=;
        b=MQbKIQo+pjW43mQk/HejKjjTRlftv9n6iVrQAzMUz/GyBvfxQjwoLr9SkRJt6bu65D
         fD4TWkq/iO0tL1FHLHRsOFg/dbK01uIw+XHIVbjyYl02aNDgg4g1o77Rgpak4S+qvqhs
         ivnQ5ZM7VO9gS6hwfCheCfwaTAA9FAHCa7ihAFd11mjozNGZtpRAK4Seh5aR+iSbQhWg
         r5eIoUgoXdooK+9/SB+9Gm/VYw26VeeRsLOkm8AaaXxNqYtOmcUXrYt4R+XdUtiUvfKV
         1dNyBb9IsPR0chN0Bz7Ku9sIE4jHw93FFqNcj7vG7DSQTs9m2CmazwxqmrRwvHuNA59z
         NifA==
X-Gm-Message-State: APt69E2pPwqUZfn+R8U2HbB8tiaaRVrqe87rCETaVhpqQSikel6ZfyYP
	xxagGBT4VBMcitSjGr4zWfG/Kg==
X-Google-Smtp-Source: ADUXVKI1g/mxBP8dor4YwFL6QICebwOWcwKHG0aX+/HozuCDzGrGlZ8oX8Z9d3ER48yxpdiNrO5qcw==
X-Received: by 2002:a25:361e:: with SMTP id d30-v6mr724426yba.35.1529082311566;
        Fri, 15 Jun 2018 10:05:11 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:ad5f:: with SMTP id l31-v6ls1352617ywk.34.gmail; Fri, 15
 Jun 2018 10:05:10 -0700 (PDT)
X-Received: by 2002:a81:4b49:: with SMTP id y70-v6mr145440ywa.1.1529082310303;
        Fri, 15 Jun 2018 10:05:10 -0700 (PDT)
In-Reply-To: <CALvx3hZQ4CMYBRfaQegK64d2JzLk0LS8y3u04id0Arbrgo2WKg@mail.gmail.com>
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:38670
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38670>

------=_Part_8236_1239228492.1529082309693
Content-Type: multipart/alternative; 
	boundary="----=_Part_8237_615840004.1529082309693"

------=_Part_8237_615840004.1529082309693
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I don't know how could it break existing functionality, since spaceship=20
operator is a new shiny thing in C++20. Just leave the old two way array=20
comparison as it is (or even deprecate it, in order to bring it back at=20
some point later with expected behavior).

Regards,
Maciej

W dniu pi=C4=85tek, 15 czerwca 2018 17:52:13 UTC+2 u=C5=BCytkownik Richard =
Hodges=20
napisa=C5=82:
>
>
>
> On Fri, 15 Jun 2018 at 17:34, <m.ce...@gmail.com <javascript:>> wrote:
>
>> Hi,
>>
>> can we finally write idiomatic comparison code for arrays with three way=
=20
>> compare?
>>
>
> Wouldn't this break existing functionality? The current meaning of (a =3D=
=3D=20
> b) when a and b are c-style arrays is to compare the addresses of the 0th=
=20
> element of each array - essentially testing whether a and b are the *same=
=20
> actual array* rather than two arrays that contain data that compares equa=
l.
>
> Comparing two std::span will certainly work, so for generic code you may=
=20
> want to consider providing overloads/specialisations for span rather than=
=20
> c-array.
>
> http://en.cppreference.com/w/cpp/container/span/operator_cmp
>
> =20
>
>>
>> bool foo()
>> {
>>     int a1[4] =3D { 1, 2, 3, 4 }, a2[4] =3D { 1, 2, 3, 4 };
>>     return (a1 <=3D> a2) =3D=3D 0;
>> }
>>
>> I really hope so, and that would we could compare arrays of different=20
>> size too (always not equal) - useful for template code.
>>
>> Regards,
>> Maciej
>>
>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d50deead-c4=
60-414b-b356-a398772b8f69%40isocpp.org=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d50deead-c=
460-414b-b356-a398772b8f69%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoo=
ter>
>> .
>>
>

--=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/fb962daa-db76-4b9c-9697-7d734d327852%40isocpp.or=
g.

------=_Part_8237_615840004.1529082309693
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I don&#39;t know how could it break existing function=
ality, since spaceship operator is a new shiny thing in C++20. Just leave t=
he old two way array comparison as it is (or even deprecate it, in order to=
 bring it back at some point later with expected behavior).</div><div><br><=
/div><div>Regards,</div><div>Maciej<br></div><br>W dniu pi=C4=85tek, 15 cze=
rwca 2018 17:52:13 UTC+2 u=C5=BCytkownik Richard Hodges napisa=C5=82:<block=
quote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-le=
ft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><br><br><div class=
=3D"gmail_quote"><div dir=3D"ltr">On Fri, 15 Jun 2018 at 17:34, &lt;<a href=
=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"JgUYy6blAgAJ" r=
el=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return tru=
e;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">m.ce...@gmai=
l.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:=
1ex"><div dir=3D"ltr">Hi,<div><br></div><div>can we finally write idiomatic=
 comparison code for arrays with three way compare?</div></div></blockquote=
><div><br></div><div>Wouldn&#39;t this break existing functionality? The cu=
rrent meaning of (a =3D=3D b) when a and b are c-style arrays is to compare=
 the addresses of the 0th element of each array - essentially testing wheth=
er a and b are the *same actual array* rather than two arrays that contain =
data that compares equal.</div><div><br></div><div>Comparing two <font face=
=3D"monospace, monospace">std::span</font> will certainly work, so for gene=
ric code you may want to consider providing overloads/specialisations for s=
pan rather than c-array.</div><div><br></div><div><a href=3D"http://en.cppr=
eference.com/w/cpp/container/span/operator_cmp" target=3D"_blank" rel=3D"no=
follow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp=
%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Fcontainer%2Fspan%2Foperator_cmp\x2=
6sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHT_pUsP8iai_Bxl9AE42vVYlea7w&#39;;ret=
urn true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%=
3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Fcontainer%2Fspan%2Foperator_cmp\x26=
sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHT_pUsP8iai_Bxl9AE42vVYlea7w&#39;;retu=
rn true;">http://en.cppreference.com/w/<wbr>cpp/container/span/operator_<wb=
r>cmp</a><br></div><div><br></div><div>=C2=A0</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"><div dir=3D"ltr"><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:rg=
b(0,0,255)">=C2=A0 =C2=A0 int</span> a1[<span style=3D"color:rgb(9,136,90)"=
>4</span>] =3D { <span style=3D"color:rgb(9,136,90)">1</span>, <span style=
=3D"color:rgb(9,136,90)">2</span>, <span style=3D"color:rgb(9,136,90)">3</s=
pan>, <span style=3D"color:rgb(9,136,90)">4</span> }, a2[<span style=3D"col=
or:rgb(9,136,90)">4</span>] =3D { <span style=3D"color:rgb(9,136,90)">1</sp=
an>, <span style=3D"color:rgb(9,136,90)">2</span>, <span style=3D"color:rgb=
(9,136,90)">3</span>, <span style=3D"color:rgb(9,136,90)">4</span> };</div>=
<div style=3D"color:rgb(0,0,0)">    <span style=3D"color:rgb(0,0,255)">=C2=
=A0 =C2=A0 return</span> (a1 &lt;=3D&gt; a2) =3D=3D <span style=3D"color:rg=
b(9,136,90)">0</span>;</div><div style=3D"color:rgb(0,0,0)">}</div><div sty=
le=3D"color:rgb(0,0,0)"><br></div><div style=3D"color:rgb(0,0,0)">I really =
hope so, and that would we could compare arrays of different size too (alwa=
ys not equal) - useful for template code.</div><div style=3D"color:rgb(0,0,=
0)"><br></div><div style=3D"color:rgb(0,0,0)">Regards,</div><div style=3D"c=
olor:rgb(0,0,0)">Maciej</div></div></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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
JgUYy6blAgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"JgUYy6blAgAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@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/d50deead-c460-414b-b356-a398772b8f69%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/d50deead-c460-414b-b356-a398772b8f69%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/d50deead-c460-414b-b356-a398772b8f69%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/d50deead-c460-414b-<wbr>b356-=
a398772b8f69%40isocpp.org</a><wbr>.<br>
</blockquote></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/fb962daa-db76-4b9c-9697-7d734d327852%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/fb962daa-db76-4b9c-9697-7d734d327852=
%40isocpp.org</a>.<br />

------=_Part_8237_615840004.1529082309693--

------=_Part_8236_1239228492.1529082309693--

.
