Topic: Optimize boolean comparisons for range check


Author: Nghia Truong <nghiatruong.vn@gmail.com>
Date: Mon, 27 Aug 2018 22:18:53 -0700 (PDT)
Raw View
------=_Part_1269_1346138738.1535433533403
Content-Type: multipart/alternative;
 boundary="----=_Part_1270_481146098.1535433533403"

------=_Part_1270_481146098.1535433533403
Content-Type: text/plain; charset="UTF-8"

Hi,

I have to write a lot of comparisons like this:

if( x > a && x < b ) { /* ... */ }


I wish that I could do a lot nicer by writing like this:

if( a < x < b ) { /* ... */ },


but I can't. Python has already been supporting this kind of comparison
operation. Why not C++? Please add this to the C++ standard if possible.
This is quite an extremely useful feature.

Thanks.

--
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/e582e43d-651e-45d3-ac25-8444962bf02d%40isocpp.org.

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

<div dir=3D"ltr">Hi,<div><br></div><div>I have to write a lot of comparison=
s like this:</div><div><br></div><blockquote style=3D"margin: 0 0 0 40px; b=
order: none; padding: 0px;"><div><font face=3D"courier new, monospace">if( =
x &gt; a &amp;&amp; x &lt; b ) { /* ... */ </font>}</div></blockquote><div>=
<br></div><div>I wish that I could do a lot nicer by writing like this:</di=
v><div><br></div><blockquote style=3D"margin: 0 0 0 40px; border: none; pad=
ding: 0px;"><div><font face=3D"courier new, monospace">if( a &lt; x &lt; b =
) { /* ... */ },</font></div></blockquote><div><br></div><div>but I can&#39=
;t. Python has already been supporting this kind of comparison operation. W=
hy not C++? Please add this to the C++ standard if possible. This is quite =
an extremely useful feature.</div><div><br></div><div>Thanks.</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/e582e43d-651e-45d3-ac25-8444962bf02d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e582e43d-651e-45d3-ac25-8444962bf02d=
%40isocpp.org</a>.<br />

------=_Part_1270_481146098.1535433533403--

------=_Part_1269_1346138738.1535433533403--

.


Author: "Francis (Grizzly) Smit" <grizzlysmit@gmail.com>
Date: Tue, 28 Aug 2018 17:15:16 +1000
Raw View
This is a multi-part message in MIME format.
--------------6205A9A9C6D93983D4E12DB4
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



On 28/08/18 15:18, Nghia Truong wrote:
> Hi,
>
> I have to write a lot of comparisons like this:
>
>     if( x > a && x < b ) { /* ... */ }
>
>
> I wish that I could do a lot nicer by writing like this:
>
>     if( a < x < b ) { /* ... */ },
>
>
> but I can't. Python has already been supporting this kind of
> comparison operation. Why not C++? Please add this to the C++ standard
> if possible. This is quite an extremely useful feature.
>
>

Perl6 has this too, as to adding to C++=C2=A0 it would be nice, but we'd ne=
ed
to look into whether it breaks code etc.


--=20

   .~.     In my life God comes first....
   /V\         but Linux is pretty high after that :-D
  /( )\    Francis (Grizzly) Smit
  ^^-^^    http://www.smit.id.au/

--=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/004fe8c5-28d7-7ea0-ecbd-28f3586a1646%40gmail.com=
..

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

<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8=
">
  </head>
  <body text=3D"#000000" bgcolor=3D"#FFFFFF">
    <p><br>
    </p>
    <br>
    <div class=3D"moz-cite-prefix">On 28/08/18 15:18, Nghia Truong wrote:<b=
r>
    </div>
    <blockquote type=3D"cite"
      cite=3D"mid:e582e43d-651e-45d3-ac25-8444962bf02d@isocpp.org">
      <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf=
-8">
      <div dir=3D"ltr">Hi,
        <div><br>
        </div>
        <div>I have to write a lot of comparisons like this:</div>
        <div><br>
        </div>
        <blockquote style=3D"margin: 0 0 0 40px; border: none; padding:
          0px;">
          <div><font face=3D"courier new, monospace">if( x &gt; a
              &amp;&amp; x &lt; b ) { /* ... */ </font>}</div>
        </blockquote>
        <div><br>
        </div>
        <div>I wish that I could do a lot nicer by writing like this:</div>
        <div><br>
        </div>
        <blockquote style=3D"margin: 0 0 0 40px; border: none; padding:
          0px;">
          <div><font face=3D"courier new, monospace">if( a &lt; x &lt; b )
              { /* ... */ },</font></div>
        </blockquote>
        <div><br>
        </div>
        <div>but I can't. Python has already been supporting this kind
          of comparison operation. Why not C++? Please add this to the
          C++ standard if possible. This is quite an extremely useful
          feature.</div>
        <div><br>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    Perl6 has this too, as to adding to C++=C2=A0 it would be nice, but we'=
d
    need to look into whether it breaks code etc.<br>
    <br>
    <br>
    <div class=3D"moz-signature">-- <br>
      <pre>   .~.     In my life God comes first....
   /V\         but Linux is pretty high after that :-D
  /( )\    Francis (Grizzly) Smit
  ^^-^^    <a class=3D"moz-txt-link-freetext" href=3D"http://www.smit.id.au=
/">http://www.smit.id.au/</a>
</pre>
    </div>
  </body>
</html>

<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/004fe8c5-28d7-7ea0-ecbd-28f3586a1646%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/004fe8c5-28d7-7ea0-ecbd-28f3586a1646%=
40gmail.com</a>.<br />

--------------6205A9A9C6D93983D4E12DB4--

.


Author: Jake Arkinstall <jake.arkinstall@gmail.com>
Date: Tue, 28 Aug 2018 08:42:19 +0100
Raw View
--000000000000db1772057479fb9b
Content-Type: text/plain; charset="UTF-8"

http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0893r1.html

--
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/CAC%2B0CCO6Qk3NTZLtN6V2pJ5JFStn0Roz_6_UHNdfXtSbJ9vS6Q%40mail.gmail.com.

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

<div dir=3D"auto"><a href=3D"http://open-std.org/JTC1/SC22/WG21/docs/papers=
/2018/p0893r1.html" target=3D"_blank" rel=3D"noreferrer">http://open-std.or=
g/JTC1/SC22/WG21/docs/papers/2018/p0893r1.html</a><br><div dir=3D"auto"><br=
></div><div dir=3D"auto"><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/CAC%2B0CCO6Qk3NTZLtN6V2pJ5JFStn0Roz_6=
_UHNdfXtSbJ9vS6Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC%2B0CCO6Qk3N=
TZLtN6V2pJ5JFStn0Roz_6_UHNdfXtSbJ9vS6Q%40mail.gmail.com</a>.<br />

--000000000000db1772057479fb9b--

.