Topic: Three way comparison of arrays


Author: m.cencora@gmail.com
Date: Fri, 15 Jun 2018 08:34:10 -0700 (PDT)
Raw View
------=_Part_7908_978029711.1529076850354
Content-Type: multipart/alternative;
 boundary="----=_Part_7909_337954557.1529076850354"

------=_Part_7909_337954557.1529076850354
Content-Type: text/plain; charset="UTF-8"

Hi,

can we finally write idiomatic comparison code for arrays with three way
compare?

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.

------=_Part_7909_337954557.1529076850354
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<div><br></div><div>can we finally write idiomatic comp=
arison code for arrays with three way compare?</div><div><br></div><div><di=
v style=3D"background-color: rgb(255, 255, 254);" liberation=3D"" mono",=3D=
"" courier,=3D"" monospace;font-weight:=3D"" normal;font-size:=3D"" 12.5411=
32799999998px;line-height:=3D"" 17px;white-space:=3D"" pre;"=3D""><div styl=
e=3D""><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"col=
or: rgb(0, 0, 0);">    <span style=3D"color: #0000ff;">=C2=A0 =C2=A0 int</s=
pan> a1[<span style=3D"color: #09885a;">4</span>] =3D { <span style=3D"colo=
r: #09885a;">1</span>, <span style=3D"color: #09885a;">2</span>, <span styl=
e=3D"color: #09885a;">3</span>, <span style=3D"color: #09885a;">4</span> },=
 a2[<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: #09885a;">4</span> };</di=
v><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);=
">I really hope so, and that would we could compare arrays of different siz=
e too (always not equal) - useful for template code.</div><div style=3D"col=
or: 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">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/d50deead-c460-414b-b356-a398772b8f69%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d50deead-c460-414b-b356-a398772b8f69=
%40isocpp.org</a>.<br />

------=_Part_7909_337954557.1529076850354--

------=_Part_7908_978029711.1529076850354--

.


Author: Richard Hodges <hodges.r@gmail.com>
Date: Fri, 15 Jun 2018 17:51:59 +0200
Raw View
--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--

.


Author: "'Matt Calabrese' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 15 Jun 2018 11:54:44 -0400
Raw View
--000000000000bef21a056eb03ca1
Content-Type: text/plain; charset="UTF-8"

On Fri, Jun 15, 2018 at 11:52 AM Richard Hodges <hodges.r@gmail.com> wrote:

> 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.
>

Heh, don't be so sure of that ;)

--
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/CANh8DEmbut8C5Q7VxsDqjwWFzMyEEFYz6ARNMbBPD5KKmOaJCg%40mail.gmail.com.

--000000000000bef21a056eb03ca1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_quote"><div dir=3D"ltr">On Fri, Jun 15=
, 2018 at 11:52 AM Richard Hodges &lt;<a href=3D"mailto:hodges.r@gmail.com"=
>hodges.r@gmail.com</a>&gt; wrote:</div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div=
 dir=3D"ltr"><div class=3D"gmail_quote"><div>Comparing two <font face=3D"mo=
nospace, monospace">std::span</font> will certainly work, so for generic co=
de you may want to consider providing overloads/specialisations for span ra=
ther than c-array.</div></div></div></blockquote><div><br></div><div>Heh, d=
on&#39;t be so sure of that ;)=C2=A0</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">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/CANh8DEmbut8C5Q7VxsDqjwWFzMyEEFYz6ARN=
MbBPD5KKmOaJCg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CANh8DEmbut8C5Q7V=
xsDqjwWFzMyEEFYz6ARNMbBPD5KKmOaJCg%40mail.gmail.com</a>.<br />

--000000000000bef21a056eb03ca1--

.


Author: m.cencora@gmail.com
Date: Fri, 15 Jun 2018 10:05:09 -0700 (PDT)
Raw View
------=_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--

.


Author: Barry Revzin <barry.revzin@gmail.com>
Date: Fri, 15 Jun 2018 10:45:12 -0700 (PDT)
Raw View
------=_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--

.


Author: m.cencora@gmail.com
Date: Fri, 15 Jun 2018 11:45:33 -0700 (PDT)
Raw View
------=_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--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 15 Jun 2018 12:03:35 -0700 (PDT)
Raw View
------=_Part_8659_1729467785.1529089415147
Content-Type: multipart/alternative;
 boundary="----=_Part_8660_34551546.1529089415147"

------=_Part_8660_34551546.1529089415147
Content-Type: text/plain; charset="UTF-8"

On Friday, June 15, 2018 at 2:45:33 PM UTC-4, m.ce...@gmail.com wrote:
>
> This is a weak argument. We sacrifice the consistency of the operator<=>
> (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.
> So I'd rather have operator<=> for arrays in all cases, and fix array
> copying as well.
>

Well, here's the thing: most people will not be using `<=>` directly.
They're going to use the fruits of `<=>`: the implicit generation of the
other 2/6 operators in both directions.

So you would need a special rule for `<=>` when applied to arrays saying
that they *don't* generate the other 2/6 operations for them. That would be
highly inconsistent.

If comparison with those operators isn't going to work for language arrays,
why should it work for `<=>`? At least with it the way it is at present, we
can later (after removing the old behavior) change the behavior to work the
way we want. Or we can just ditch language arrays altogether.

--
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/75095771-64a6-434c-b9d0-a9d4b1726ce5%40isocpp.org.

------=_Part_8660_34551546.1529089415147
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, June 15, 2018 at 2:45:33 PM UTC-4, m.ce...@gmai=
l.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><=
div>This is a weak argument. We sacrifice the consistency of the operator&l=
t;=3D&gt; (works for all types) for doubtful consistency of copy and compar=
e (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&g=
t; for arrays in all cases, and fix array copying as well.<br></div></div><=
/blockquote><div><br></div><div>Well, here&#39;s the thing: most people wil=
l not be using `&lt;=3D&gt;` directly. They&#39;re going to use the fruits =
of `&lt;=3D&gt;`: the implicit generation of the other 2/6 operators in bot=
h directions.</div><div><br></div><div>So you would need a special rule for=
 `&lt;=3D&gt;` when applied to arrays saying that they <i>don&#39;t</i> gen=
erate the other 2/6 operations for them. That would be highly inconsistent.=
</div><div><br></div><div>If comparison with those operators isn&#39;t goin=
g to work for language arrays, why should it work for `&lt;=3D&gt;`? At lea=
st with it the way it is at present, we can later (after removing the old b=
ehavior) change the behavior to work the way we want. Or we can just ditch =
language arrays altogether.<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/75095771-64a6-434c-b9d0-a9d4b1726ce5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/75095771-64a6-434c-b9d0-a9d4b1726ce5=
%40isocpp.org</a>.<br />

------=_Part_8660_34551546.1529089415147--

------=_Part_8659_1729467785.1529089415147--

.


Author: m.cencora@gmail.com
Date: Fri, 15 Jun 2018 12:14:14 -0700 (PDT)
Raw View
------=_Part_8468_446422807.1529090054260
Content-Type: multipart/alternative;
 boundary="----=_Part_8469_1813322198.1529090054260"

------=_Part_8469_1813322198.1529090054260
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

That argument certainly sounds saner to me. But still we could have this=20
inconsistency only temporary until we switch two-way array comparison to=20
new behavior.
As for ditching builtin arrays - that's way more improbable scenario.

W dniu pi=C4=85tek, 15 czerwca 2018 21:03:35 UTC+2 u=C5=BCytkownik Nicol Bo=
las=20
napisa=C5=82:
>
> On Friday, June 15, 2018 at 2:45:33 PM UTC-4, m.ce...@gmail.com wrote:
>>
>> 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.
>>
>
> Well, here's the thing: most people will not be using `<=3D>` directly.=
=20
> They're going to use the fruits of `<=3D>`: the implicit generation of th=
e=20
> other 2/6 operators in both directions.
>
> So you would need a special rule for `<=3D>` when applied to arrays sayin=
g=20
> that they *don't* generate the other 2/6 operations for them. That would=
=20
> be highly inconsistent.
>
> If comparison with those operators isn't going to work for language=20
> arrays, why should it work for `<=3D>`? At least with it the way it is at=
=20
> present, we can later (after removing the old behavior) change the behavi=
or=20
> to work the way we want. Or we can just ditch language arrays altogether.
>

--=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/6c44093f-c431-4f80-8688-f6d978a1b080%40isocpp.or=
g.

------=_Part_8469_1813322198.1529090054260
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>That argument certainly sounds saner to me. But still=
 we could have this inconsistency only temporary until we switch two-way ar=
ray comparison to new behavior.</div><div>As for ditching builtin arrays - =
that&#39;s way more improbable scenario.<br></div><br>W dniu pi=C4=85tek, 1=
5 czerwca 2018 21:03:35 UTC+2 u=C5=BCytkownik Nicol Bolas napisa=C5=82:<blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-=
left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On Friday, June 1=
5, 2018 at 2:45:33 PM UTC-4, <a>m.ce...@gmail.com</a> wrote:<blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc=
 solid;padding-left:1ex"><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><d=
iv>So I&#39;d rather have operator&lt;=3D&gt; for arrays in all cases, and =
fix array copying as well.<br></div></div></blockquote><div><br></div><div>=
Well, here&#39;s the thing: most people will not be using `&lt;=3D&gt;` dir=
ectly. They&#39;re going to use the fruits of `&lt;=3D&gt;`: the implicit g=
eneration of the other 2/6 operators in both directions.</div><div><br></di=
v><div>So you would need a special rule for `&lt;=3D&gt;` when applied to a=
rrays saying that they <i>don&#39;t</i> generate the other 2/6 operations f=
or them. That would be highly inconsistent.</div><div><br></div><div>If com=
parison with those operators isn&#39;t going to work for language arrays, w=
hy should it work for `&lt;=3D&gt;`? At least with it the way it is at pres=
ent, we can later (after removing the old behavior) change the behavior to =
work the way we want. Or we can just ditch language arrays altogether.<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/6c44093f-c431-4f80-8688-f6d978a1b080%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6c44093f-c431-4f80-8688-f6d978a1b080=
%40isocpp.org</a>.<br />

------=_Part_8469_1813322198.1529090054260--

------=_Part_8468_446422807.1529090054260--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Fri, 15 Jun 2018 15:34:02 -0400
Raw View
--0000000000005db539056eb34c0a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, Jun 15, 2018 at 2:45 PM, <m.cencora@gmail.com> wrote:

> This is a weak argument. We sacrifice the consistency of the operator<=3D=
>
> (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.
>


Typically it is more important to be "locally" or "self" - consistent, than
to be "broadly" or "cross" - consistent.
So we keep arrays self-consistent, but lose consistency across <=3D>.




> So I'd rather have operator<=3D> for arrays in all cases, and fix array
> copying as well.
>
> Regards,
> Maciej
>
> W dniu pi=C4=85tek, 15 czerwca 2018 19:45:12 UTC+2 u=C5=BCytkownik Barry =
Revzin
> 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 wa=
y
>>> 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
>> 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 copy=
able in
>>> the language, to keep copying and comparison consistent. Note that for =
two
>>> arrays, arr1<=3D>arr2 is ill-formed because the array-to-pointer conver=
sion
>>> is not applied
>>>
>>
>> Additionally, in Rapperswil, the two-way comparisons between arrays (i.e=
..
>> a1 =3D=3D a2) were deprecated. So now at least they both consistently wi=
ll not
>> work.
>>
>> --
> 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/60dffd75-ebc3-4e4c-
> 8666-f304be8f6136%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/60dffd75-eb=
c3-4e4c-8666-f304be8f6136%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>



--=20
Be seeing you,
Tony

--=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/CAOHCbitza9P%2Bn4%3DnJDX7xcPVa-JqOW_iotaJ%2BBh%2=
B2N8Mx6Biug%40mail.gmail.com.

--0000000000005db539056eb34c0a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Fri, Jun 15, 2018 at 2:45 PM,  <span dir=3D"ltr">&lt;<a href=3D"mail=
to:m.cencora@gmail.com" target=3D"_blank">m.cencora@gmail.com</a>&gt;</span=
> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>This is a =
weak argument. We sacrifice the consistency of the operator&lt;=3D&gt; (wor=
ks 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 programme=
r intents.</div></div></blockquote><div><br></div><div><br></div><div>Typic=
ally it is more important to be &quot;locally&quot; or &quot;self&quot; - c=
onsistent, than to be &quot;broadly&quot; or &quot;cross&quot; - consistent=
..</div><div>So we keep arrays self-consistent, but lose consistency across =
&lt;=3D&gt;.<br></div><div><br></div><div><br></div><div>=C2=A0</div><block=
quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc=
 solid;padding-left:1ex"><div dir=3D"ltr"><div>So I&#39;d rather have opera=
tor&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><span class=3D"=
">=C2=A0<br>W dniu pi=C4=85tek, 15 czerwca 2018 19:45:12 UTC+2 u=C5=BCytkow=
nik Barry Revzin napisa=C5=82:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0;margin-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.=
...@gmail.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">Hi,<div><br></div><div>can we finally write idiomatic comparison code =
for arrays with three way compare?</div><div><br></div><div><div style=3D"b=
ackground-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 {=
 <span style=3D"color:#09885a">1</span>, <span style=3D"color:#09885a">2</s=
pan>, <span style=3D"color:#09885a">3</span>, <span style=3D"color:#09885a"=
>4</span> }, a2[<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:#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:#0=
9885a">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 reject=
ed by design. Quoting from=C2=A0=C2=A0<a href=3D"http://www.open-std.org/jt=
c1/sc22/wg21/docs/papers/2017/p0515r3.pdf" rel=3D"nofollow" target=3D"_blan=
k">http://www.open-std.org/<wbr>jtc1/sc22/wg21/docs/papers/201<wbr>7/p0515r=
3.pdf</a>:</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex">For arrays, we don=E2=80=99t provide comparison if the array is not c=
opyable 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></span></div><span class=3D"">

<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@<wbr>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></span>
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&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/60df=
fd75-ebc3-4e4c-<wbr>8666-f304be8f6136%40isocpp.org</a><wbr>.<br>
</blockquote></div><br><br clear=3D"all"><br>-- <br><div class=3D"gmail_sig=
nature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div>Be seeing =
you,<br></div>Tony<br></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">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/CAOHCbitza9P%2Bn4%3DnJDX7xcPVa-JqOW_i=
otaJ%2BBh%2B2N8Mx6Biug%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoo=
ter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbitz=
a9P%2Bn4%3DnJDX7xcPVa-JqOW_iotaJ%2BBh%2B2N8Mx6Biug%40mail.gmail.com</a>.<br=
 />

--0000000000005db539056eb34c0a--

.