220 38668 <CALvx3hZQ4CMYBRfaQegK64d2JzLk0LS8y3u04id0Arbrgo2WKg@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Richard Hodges <hodges.r@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Three way comparison of arrays
Date: Fri, 15 Jun 2018 17:51:59 +0200
Lines: 132
Approved: news@gmane.org
Message-ID: <CALvx3hZQ4CMYBRfaQegK64d2JzLk0LS8y3u04id0Arbrgo2WKg@mail.gmail.com>
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/alternative; boundary="000000000000ecbf94056eb032cc"
X-Trace: blaine.gmane.org 1529077809 8020 195.159.176.226 (15 Jun 2018 15:50:09 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 15 Jun 2018 15:50:09 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBD4PBM7UWAHRBLGBR7MQKGQEWWWK4OI@isocpp.org Fri Jun 15 17:50:05 2018
Return-path: <std-proposals+bncBD4PBM7UWAHRBLGBR7MQKGQEWWWK4OI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f198.google.com ([209.85.223.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBD4PBM7UWAHRBLGBR7MQKGQEWWWK4OI@isocpp.org>)
	id 1fTqzC-0001td-3D
	for gclcip-std-proposals@m.gmane.org; Fri, 15 Jun 2018 17:50:02 +0200
Original-Received: by mail-io0-f198.google.com with SMTP id r10-v6sf7587438ioh.7
        for <gclcip-std-proposals@m.gmane.org>; Fri, 15 Jun 2018 08:52:13 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1529077933; cv=pass;
        d=google.com; s=arc-20160816;
        b=Wjyrfh0wd41nJ8wD212oNo54RfGQpZ98kBZrKt4H+ocnhn4aA8wNpcJ/xgmqwVn2oB
         9qkyB0tEgkNGWZon+nnvClnq/JzjrLDRSwn1INmfRf+S2WOMGIa0UU4xT1yQ4rn8yvny
         CBescdWmLFg2FXTzFTPuVVNuMLAzAXP/SdKGayAiNrvEJ8yiGm7ZycCvfwIkJzwayX5W
         DRecm+6EUwwjML/fYesda2Iv3+ZwWidVr9f8aMKi3/Sv9yE16SZASm64eJiUf/aFfIkg
         CyXFl25EoQjE+jEpK3yIBix1NqPGocAE+NtWU2u0sE4Xo+XoZX5IzgmPYh9wScWQP862
         gqjQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:in-reply-to:references:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=dmbqgvDJlkOUiJc5JxTTNmhwMLYLkulPqe+iCtMvC6w=;
        b=LYn6kSi4eDuMUNkMun9QE1GKlNd5LLNsBhe37eVyCj4enZ4YBci1pSRIyQN7rxKS/8
         B4tvTYiQR438CxN/gSeEEL0ZjzJwytpKktBdJojRPviVmD080SwPNSG6hRnr06lIICmq
         W3bCIc3DEQkNXS6dlJWaH/0l06hzFDgnyNFVJMLKymO0aCdrH3lHFfb4LYiesDzZoX3d
         O7fOpDXoo/T61GYZUGzh/bgnuIZnkPbqrw5uXvHVzCHA+EXOMotGDBacCSW3wighDMxD
         E3W85++ZvgfTsMmmhXtRJ7ntOrArhBZbj5FACbnC+DBdyyBiKSmNbj+TY4viJzL5PMKt
         TMSw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qh8A7NmW;
       spf=pass (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=hodges.r@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=dmbqgvDJlkOUiJc5JxTTNmhwMLYLkulPqe+iCtMvC6w=;
        b=wTWYrPXvs9UMTEPdlqMeBW5r9G2zJdn2dmnKqXVhwidzlN3pYkZlNvLJOYtpKNbc0z
         Wc1nuzMN4DeI7hBTekWVl1P4D7TUY8Ru/2VaPnEG+dzYZQrmx3u1gNncQ5Xe8eD/IxON
         41DNbfb8Pb7hnZsKcl/WKkQUgWBrBmosoy+svSe+cw7GSs2uPD0iTeEmDvrvpJ45i8Fg
         UE1iMXfer2eUfCp5n7/XKczG+ZMx9QHC6T3PwMaQ8erV6LSZK288cyrhD7276uqbzB3A
         5ULYishI27x8d+dY5QSCSazxgygSA5T5spUQz/d20M3wdUQtgW2lp8/1su5101/NW3hO
         gHJQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject: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=dmbqgvDJlkOUiJc5JxTTNmhwMLYLkulPqe+iCtMvC6w=;
        b=C3/TWFKGcflYApc7IB0z3HjlBq81BWhgL11dast331ijKVe4XNeFjctTt86h5oA6AW
         skU7t6FeeHkyeIm7jujCOiv34SdmD8afhFGbtS34hxJvmCQj8V0jgjSGJn85p65bQ8R/
         dTHUYh4YDvRTsUGZduiJvEv+tKvITWQ1Xj6l4EjviZLZfFpAfM14L3x6JnTOJ3hhrDcH
         isGNKkAvDzf4JrnLEf7WYVKifEj9ZZwvoskYWfgyuAxeV0/D0kNXqQwXYul9bMEF2LMv
         JzCF36wUfpgGmxsEL9/DN0IOkdUhg48C7b2SoTGF/4tSg3SV8LW3Cl0FVT3x8NW3TiKh
         Whxg==
X-Gm-Message-State: APt69E0x6zh8i3ZyfYMVvF8iKtbLOJtTfS1+74GcD7CZxPkD8Wu+WjTl
	qq/tiCI7G+oYJ4iRZX+q8RgJgQ==
X-Google-Smtp-Source: ADUXVKJhdkVvYJnbMmGe21LfirWTVPWS5trK7K0zx/4tgNIrF29EKNdWH3LOHJMvDTei8r1pby1ObA==
X-Received: by 2002:a02:93c1:: with SMTP id z59-v6mr620940jah.41.1529077933030;
        Fri, 15 Jun 2018 08:52:13 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a24:76c5:: with SMTP id z188-v6ls424294itb.3.canary-gmail;
 Fri, 15 Jun 2018 08:52:11 -0700 (PDT)
X-Received: by 2002:a24:4124:: with SMTP id x36-v6mr1634491ita.131.1529077931718;
        Fri, 15 Jun 2018 08:52:11 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1529077931; cv=none;
        d=google.com; s=arc-20160816;
        b=iG+OZ6MWTS+BXZ+7x7DKZG4YBd2BMs8Xpk7z07zGczBHGAFO8VTjm/CZVtVcqw3rge
         YcYhV1E/3D9HRBeMFWMRjprV3b2SdUMgjM3JDClDGKCqvqaEFyOZGiFHf5sm+Jax45dr
         TrnDUz4dcGdDokVtHDIbQunzCyZJmxDq/6RcpVOyyARAQw42kRAxzeEjjMU55Dn/6TQu
         kgR+4rWRdq3mDPZoT9NketQrSE5yEBhScbLe/NLJtqtbH/bOFKq2b4GwfwuDncK1GaHZ
         p/hKGOozO8Byfouo8q5v5O7wXwEue+Dsn+qVeqDj6xiYx3SiQs7itFFBR5/bxlegEsOQ
         IcMA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature:arc-authentication-results;
        bh=0zDELxNrYlAdFRyi9wwPQyAoPwL/AigOTt7uuTLqtTM=;
        b=u1KdlM/o0+cmdBlGWFGA3VL474cfMkQM9FKFUg9A7RYBFnD6YX8k6L9QyvraC2MgmJ
         SDnPB4L0EONniwAssrTaAQgwwydgh5VY/jAxjaNEfQ5waA7bLKtcGD52ov2BjJ61mE+K
         +gKoFgl2jwL2nFjeup0myCDmVWOIi4J57lQdsZNWoVJgdT6mRzRz3DWBmVUPOxOJfp5f
         5N6zzNto7LWunbbbdui4syUyj5FZD3woXoqUU8yCxXuSKVxk94AzjMT3cmPAwQwe7RVL
         cMOVbKQZXplpdUjjL+g2p4wdp6FVRTqQ1n+F07K05IWE+cSXWWPzA5LQ8isF09fCljKu
         +J6g==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=Qh8A7NmW;
       spf=pass (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=hodges.r@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id m189-v6sor3438568ioa.206.2018.06.15.08.52.11
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 15 Jun 2018 08:52:11 -0700 (PDT)
Received-SPF: pass (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 2002:a6b:2348:: with SMTP id j69-v6mr2145147ioj.100.1529077931227;
 Fri, 15 Jun 2018 08:52:11 -0700 (PDT)
In-Reply-To: <d50deead-c460-414b-b356-a398772b8f69@isocpp.org>
X-Original-Sender: hodges.r@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=Qh8A7NmW;       spf=pass
 (google.com: domain of hodges.r@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=hodges.r@gmail.com;       dmarc=pass (p=NONE
 sp=QUARANTINE 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:38668
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/38668>

--000000000000ecbf94056eb032cc
Content-Type: text/plain; charset="UTF-8"

On Fri, 15 Jun 2018 at 17:34, <m.cencora@gmail.com> wrote:

> Hi,
>
> can we finally write idiomatic comparison code for arrays with three way
> compare?
>

Wouldn't this break existing functionality? The current meaning of (a == b)
when a and b are c-style arrays is to compare the addresses of the 0th
element of each array - essentially testing whether a and b are the *same
actual array* rather than two arrays that contain data that compares equal.

Comparing two std::span will certainly work, so for generic code you may
want to consider providing overloads/specialisations for span rather than
c-array.

http://en.cppreference.com/w/cpp/container/span/operator_cmp



>
> bool foo()
> {
>     int a1[4] = { 1, 2, 3, 4 }, a2[4] = { 1, 2, 3, 4 };
>     return (a1 <=> a2) == 0;
> }
>
> I really hope so, and that would we could compare arrays of different size
> too (always not equal) - useful for template code.
>
> Regards,
> Maciej
>
> --
> 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
> email 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/d50deead-c460-414b-b356-a398772b8f69%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d50deead-c460-414b-b356-a398772b8f69%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

-- 
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 email 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/CALvx3hZQ4CMYBRfaQegK64d2JzLk0LS8y3u04id0Arbrgo2WKg%40mail.gmail.com.

--000000000000ecbf94056eb032cc
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<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"mailto:m.cencora@gmail.com">m.cencor=
a@gmail.com</a>&gt; wrote:<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"><div dir=3D"ltr">Hi,<div><br></div><div>can we finally write idi=
omatic comparison code for arrays with three way compare?</div></div></bloc=
kquote><div><br></div><div>Wouldn&#39;t this break existing functionality? =
The current meaning of (a =3D=3D b) when a and b are c-style arrays is to c=
ompare the addresses of the 0th element of each array - essentially testing=
 whether a and b are the *same actual array* rather than two arrays that co=
ntain data that compares equal.</div><div><br></div><div>Comparing two <fon=
t face=3D"monospace, monospace">std::span</font> will certainly work, so fo=
r generic code you may want to consider providing overloads/specialisations=
 for span rather than c-array.</div><div><br></div><div><a href=3D"http://e=
n.cppreference.com/w/cpp/container/span/operator_cmp">http://en.cppreferenc=
e.com/w/cpp/container/span/operator_cmp</a><br></div><div><br></div><div>=
=C2=A0</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"><div dir=3D"l=
tr"><div><br></div><div><div style=3D"background-color:rgb(255,255,254)"><d=
iv><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:rgb(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 s=
tyle=3D"color:rgb(9,136,90)">3</span>, <span style=3D"color:rgb(9,136,90)">=
4</span> }, a2[<span style=3D"color:rgb(9,136,90)">4</span>] =3D { <span st=
yle=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</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:rgb(9,136,90)">0</span>;</div><div style=3D"c=
olor:rgb(0,0,0)">}</div><div style=3D"color:rgb(0,0,0)"><br></div><div styl=
e=3D"color:rgb(0,0,0)">I really hope so, and that would we could compare ar=
rays of different size too (always 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"color: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"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/d50deead-c460-414b-b356-a398772b8f69%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d50deead-c460-=
414b-b356-a398772b8f69%40isocpp.org</a>.<br>
</blockquote></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/CALvx3hZQ4CMYBRfaQegK64d2JzLk0LS8y3u0=
4id0Arbrgo2WKg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hZQ4CMYBRfa=
QegK64d2JzLk0LS8y3u04id0Arbrgo2WKg%40mail.gmail.com</a>.<br />

--000000000000ecbf94056eb032cc--

.
