Topic: is_clamped
Author: =?UTF-8?Q?Johel_Ernesto_Guerrero_Pe=C3=B1a?= <johelegp@gmail.com>
Date: Wed, 9 Jan 2019 09:55:43 -0800 (PST)
Raw View
------=_Part_2523_411661881.1547056543313
Content-Type: multipart/alternative;
boundary="----=_Part_2524_686055745.1547056543313"
------=_Part_2524_686055745.1547056543313
Content-Type: text/plain; charset="UTF-8"
Greetings.
I have written a proposal to add is_clamped to the standard, and would
appreciate any feedback on it.
Source: https://github.com/johelegp/proposals/blob/master/is_clamped.md
Abstract
Introduce `std::is_clamped(v, lo, hi)` to mean `lo <= v && v <= hi`, except
that `v` is only evaluated once.
| Now | Proposed alternative
|
| -------------------------------------------------- |
------------------------------------------------ |
| `Axis::x <= Coord::axis && Coord::axis <= Axis::z` |
`std::is_clamped(Coord::axis, Axis::x, Axis::z)` |
| Now | Proposed alternative +
P0330 [4] |
| -------------------------------------------- |
------------------------------------------ |
| `1u <= digits.size() && digits.size() <= 7u` |
`std::is_clamped(digits.size(), 1uz, 7uz)` |
If everything's well, I'll ask for a document number and submit it to the
next mailing list.
In that case, I'd appreciate if somebody could offer presenting it at the
meeting.
Thank you.
--
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/213ffba6-0a28-4e74-bbd6-a37437e16f77%40isocpp.org.
------=_Part_2524_686055745.1547056543313
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Greetings.</div><div><br></div><div>I have written a =
proposal to add <span style=3D"font-family: courier new, monospace;">is_cla=
mped</span> to the standard, and would appreciate any feedback on it.<div><=
br></div><div>Source: <a href=3D"https://github.com/johelegp/proposals/blob=
/master/is_clamped.md">https://github.com/johelegp/proposals/blob/master/is=
_clamped.md</a></div><div><br></div><div style=3D"text-align: center;"><fon=
t size=3D"4">Abstract</font></div><div><span style=3D"font-family: courier =
new, monospace;">Introduce `std::is_clamped(v, lo, hi)` to mean `lo <=3D=
v && v <=3D hi`, except that `v` is only evaluated once.<br><br=
>| Now =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0| Proposed alternative =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=
<br>| -------------------------------------------------- | ----------------=
-------------------------------- |<br>| `Axis::x <=3D Coord::axis &&=
amp; Coord::axis <=3D Axis::z` | `std::is_clamped(Coord::axis, Axis::x, =
Axis::z)` |<br><br>| Now =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0| Proposed alternative + P0330 [4] =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 |<br>| -------------------------------------------- | =
------------------------------------------ |<br>| `1u <=3D digits.size()=
&& digits.size() <=3D 7u` | `std::is_clamped(digits.size(), 1uz=
, 7uz)` |</span><br><br></div><div><br></div></div><div>If everything's=
well, I'll ask for a document number and submit it to the next mailing=
list.</div><div>In that case, I'd appreciate if somebody could offer p=
resenting it at the meeting.<br></div><div><br></div><div>Thank you.<br></d=
iv></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/213ffba6-0a28-4e74-bbd6-a37437e16f77%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/213ffba6-0a28-4e74-bbd6-a37437e16f77=
%40isocpp.org</a>.<br />
------=_Part_2524_686055745.1547056543313--
------=_Part_2523_411661881.1547056543313--
.
Author: Ray Hamel <rayghamel@gmail.com>
Date: Wed, 9 Jan 2019 10:22:51 -0800 (PST)
Raw View
------=_Part_2652_719269355.1547058172036
Content-Type: text/plain; charset="UTF-8"
Might it be more useful to return an ordering instead of a bool?
-Ray
--
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/d0ca7efb-febb-4f2d-ba28-daf987ff4a79%40isocpp.org.
------=_Part_2652_719269355.1547058172036--
.
Author: Andrew Giese <gieseanw@gmail.com>
Date: Thu, 10 Jan 2019 06:23:28 -0600
Raw View
--000000000000184ff4057f19a696
Content-Type: text/plain; charset="UTF-8"
I like the abstraction this provides.
It's possible that Type1 v is comparable to Type2 lo and Type3 hi.
Restricting all types of is_clamped to T may be needlessly restrictive. See
how range based for loops evolved in a similar way (allowing begin and end
to return different types so long as they were comparable).
Regards,
Andy
On Wed, Jan 9, 2019, 12:22 PM Ray Hamel <rayghamel@gmail.com wrote:
> Might it be more useful to return an ordering instead of a bool?
>
> -Ray
>
> --
> 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/d0ca7efb-febb-4f2d-ba28-daf987ff4a79%40isocpp.org
> .
>
--
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/CAO8_tC7KALS%2B99JNksW1z0-O%3DfBZgs7JNatsDOd9TJvxiMOiyQ%40mail.gmail.com.
--000000000000184ff4057f19a696
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"auto"><div dir=3D"auto">I like the abstraction this provides.</=
div><div dir=3D"auto"><br></div>It's possible that Type1 v is comparabl=
e to Type2 lo and Type3 hi. Restricting all types of is_clamped to T may be=
needlessly restrictive. See how range based for loops evolved in a similar=
way (allowing begin and end to return different types so long as they were=
comparable).<div dir=3D"auto"><br></div><div dir=3D"auto">Regards,</div><d=
iv dir=3D"auto">Andy</div></div><br><div class=3D"gmail_quote"><div dir=3D"=
ltr">On Wed, Jan 9, 2019, 12:22 PM Ray Hamel <<a href=3D"mailto:rayghame=
l@gmail.com">rayghamel@gmail.com</a> wrote:<br></div><blockquote class=3D"g=
mail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-l=
eft:1ex">Might it be more useful to return an ordering instead of a bool?<b=
r>
<br>
-Ray<br>
<br>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank" rel=3D"noreferrer">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" rel=3D"noreferrer">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/d0ca7efb-febb-4f2d-ba28-daf987ff4a79%=
40isocpp.org" rel=3D"noreferrer noreferrer" target=3D"_blank">https://group=
s.google.com/a/isocpp.org/d/msgid/std-proposals/d0ca7efb-febb-4f2d-ba28-daf=
987ff4a79%40isocpp.org</a>.<br>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CAO8_tC7KALS%2B99JNksW1z0-O%3DfBZgs7J=
NatsDOd9TJvxiMOiyQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAO8_tC7KALS%=
2B99JNksW1z0-O%3DfBZgs7JNatsDOd9TJvxiMOiyQ%40mail.gmail.com</a>.<br />
--000000000000184ff4057f19a696--
.
Author: Jake Arkinstall <jake.arkinstall@gmail.com>
Date: Thu, 10 Jan 2019 12:47:21 +0000
Raw View
--0000000000005b635d057f19fbaf
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
I agree that this is something that will be very useful.
The issues I have are:
- The name. It makes sense in the context of clamped values, but it has
uses outside of that (generically checking if the value is between two
others), and so "is_between", or more simply "between", would be more
suitable IMO. In many cases, clamping is a type-level restriction rather
than a value check (e.g. a wrapper around a variable which either refuses
values outside a range, or which uses a modulus to alter a provided value
to lie between the range).
- It covers one use case out of 4 (a<b<c, a<b<=3Dc, a<=3Db<c, a<=3Db<=3Dc).=
It
makes sense, given the primary use case of clamping and the most common
usage of "between" in English, for the one you've chosen to be the default
(although having a default is often the cause of bugs - the line between
usability and assumption is often a blurry one).
On Wed, 9 Jan 2019, 17:55 Johel Ernesto Guerrero Pe=C3=B1a <johelegp@gmail.=
com
wrote:
> Greetings.
>
> I have written a proposal to add is_clamped to the standard, and would
> appreciate any feedback on it.
>
> Source: https://github.com/johelegp/proposals/blob/master/is_clamped.md
>
> Abstract
> Introduce `std::is_clamped(v, lo, hi)` to mean `lo <=3D v && v <=3D hi`,
> except that `v` is only evaluated once.
>
> | Now | Proposed
> alternative |
> | -------------------------------------------------- |
> ------------------------------------------------ |
> | `Axis::x <=3D Coord::axis && Coord::axis <=3D Axis::z` |
> `std::is_clamped(Coord::axis, Axis::x, Axis::z)` |
>
> | Now | Proposed alternative +
> P0330 [4] |
> | -------------------------------------------- |
> ------------------------------------------ |
> | `1u <=3D digits.size() && digits.size() <=3D 7u` |
> `std::is_clamped(digits.size(), 1uz, 7uz)` |
>
>
> If everything's well, I'll ask for a document number and submit it to the
> next mailing list.
> In that case, I'd appreciate if somebody could offer presenting it at the
> meeting.
>
> Thank you.
>
> --
> 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/213ffba6-0a2=
8-4e74-bbd6-a37437e16f77%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/213ffba6-0a=
28-4e74-bbd6-a37437e16f77%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>
--=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/CAC%2B0CCO1QKw07hOdxSyW1xBBu3%3DkDfrec5qQstqGwW3=
PRq-UYw%40mail.gmail.com.
--0000000000005b635d057f19fbaf
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"auto"><div dir=3D"auto">I agree that this is something that wil=
l be very useful.</div><div dir=3D"auto"><br></div><div>The issues I have a=
re:</div><div dir=3D"auto"><br></div><div dir=3D"auto">- The name. It makes=
sense in the context of clamped values, but it has uses outside of that (g=
enerically checking if the value is between two others), and so "is_be=
tween", or more simply "between", would be more suitable IMO=
.. In many cases, clamping is a type-level restriction rather than a value c=
heck (e.g. a wrapper around a variable which either refuses values outside =
a range, or which uses a modulus to alter a provided value to lie between t=
he range).</div><div dir=3D"auto"><br></div><div dir=3D"auto">- It covers o=
ne use case out of 4 (a<b<c, a<b<=3Dc, a<=3Db<c, a<=3D=
b<=3Dc). It makes sense, given the primary use case of clamping and the =
most common usage of "between" in English, for the one you've=
chosen to be the default (although having a default is often the cause of =
bugs - the line between usability and assumption is often a blurry one).</d=
iv><div dir=3D"auto"><br><div class=3D"gmail_quote" dir=3D"auto"><div dir=
=3D"ltr">On Wed, 9 Jan 2019, 17:55 Johel Ernesto Guerrero Pe=C3=B1a <<a =
href=3D"mailto:johelegp@gmail.com" target=3D"_blank" rel=3D"noreferrer">joh=
elegp@gmail.com</a> wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><div>Greetings.</div><div><br></div><div>I have written a proposal=
to add <span style=3D"font-family:courier new,monospace">is_clamped</span>=
to the standard, and would appreciate any feedback on it.<div><br></div><d=
iv>Source: <a href=3D"https://github.com/johelegp/proposals/blob/master/is_=
clamped.md" rel=3D"noreferrer noreferrer" target=3D"_blank">https://github.=
com/johelegp/proposals/blob/master/is_clamped.md</a></div><div><br></div><d=
iv style=3D"text-align:center"><font size=3D"4">Abstract</font></div><div><=
span style=3D"font-family:courier new,monospace">Introduce `std::is_clamped=
(v, lo, hi)` to mean `lo <=3D v && v <=3D hi`, except that `v=
` is only evaluated once.<br><br>| Now =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| Proposed alter=
native =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |<br>| ------------------------------------=
-------------- | ------------------------------------------------ |<br>| `A=
xis::x <=3D Coord::axis && Coord::axis <=3D Axis::z` | `std::=
is_clamped(Coord::axis, Axis::x, Axis::z)` |<br><br>| Now =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| Proposed alternati=
ve + P0330 [4] =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |<br>| ------------------=
-------------------------- | ------------------------------------------ |<b=
r>| `1u <=3D digits.size() && digits.size() <=3D 7u` | `std::=
is_clamped(digits.size(), 1uz, 7uz)` |</span><br><br></div><div><br></div><=
/div><div>If everything's well, I'll ask for a document number and =
submit it to the next mailing list.</div><div>In that case, I'd appreci=
ate if somebody could offer presenting it at the meeting.<br></div><div><br=
></div><div>Thank you.<br></div></div>
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" rel=3D"nore=
ferrer noreferrer" 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" rel=3D"noreferrer noreferrer" 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/213ffba6-0a28-4e74-bbd6-a37437e16f77%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" rel=3D"noreferrer =
noreferrer" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgi=
d/std-proposals/213ffba6-0a28-4e74-bbd6-a37437e16f77%40isocpp.org</a>.<br>
</blockquote></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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%2B0CCO1QKw07hOdxSyW1xBBu3%3DkDfre=
c5qQstqGwW3PRq-UYw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC%2B0CCO1QK=
w07hOdxSyW1xBBu3%3DkDfrec5qQstqGwW3PRq-UYw%40mail.gmail.com</a>.<br />
--0000000000005b635d057f19fbaf--
.
Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Thu, 10 Jan 2019 10:34:13 -0500
Raw View
On 10/01/2019 07.47, Jake Arkinstall wrote:
> - The name. It makes sense in the context of clamped values, but it has
> uses outside of that (generically checking if the value is between two
> others), and so "is_between", or more simply "between", would be more
> suitable IMO.
Have we learned nothing from decades of Qt having a beautiful, intuitive
API and STL having an ugly, confusing API?
*is*_between, please! Let's not repeat the mistake that is empty() yet
again.
Although if it returns a comparator (and I like that idea),
compare_between might be a better name. (Depending on if an implicit
bool conversion does what you expect. If it does, than is_between is okay.)
> - It covers one use case out of 4 (a<b<c, a<b<=c, a<=b<c, a<=b<=c). It
> makes sense, given the primary use case of clamping and the most common
> usage of "between" in English, for the one you've chosen to be the default
> (although having a default is often the cause of bugs - the line between
> usability and assumption is often a blurry one).
That could be fixed by the addition of an optional parameter to specify
which bounds (upper, lower, both) are inclusive, with the default being
"neither". That may be a good addition.
--
Matthew
--
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/47a9694e-b4c7-a4eb-260e-1df808e023e5%40gmail.com.
.
Author: Barry Revzin <barry.revzin@gmail.com>
Date: Thu, 10 Jan 2019 08:16:59 -0800 (PST)
Raw View
------=_Part_389_115616345.1547137019392
Content-Type: multipart/alternative;
boundary="----=_Part_390_1945373559.1547137019393"
------=_Part_390_1945373559.1547137019393
Content-Type: text/plain; charset="UTF-8"
On Thursday, January 10, 2019 at 9:34:17 AM UTC-6, Matthew Woehlke wrote:
>
> > - It covers one use case out of 4 (a<b<c, a<b<=c, a<=b<c, a<=b<=c). It
> > makes sense, given the primary use case of clamping and the most common
> > usage of "between" in English, for the one you've chosen to be the
> default
> > (although having a default is often the cause of bugs - the line between
> > usability and assumption is often a blurry one).
>
> That could be fixed by the addition of an optional parameter to specify
> which bounds (upper, lower, both) are inclusive, with the default being
> "neither". That may be a good addition.
>
I feel like in case where my middle is an expression, I'd much rather
write:
[&]{
auto&& e = some-complex-expr;
return lo < e && e < hi;
}();
Than whatever I would have to do:
is_between(some-complex-expr, lo, hi, exclusive_lo, excusive_hi); // this?
is_between(some-complex-expr, exclusive{lo}, exclusive{hi}); // or this?
// or something else?
And in the case where I have a variable and not a complex expression, I
have a hard time seeing the benefit. I find the "Now" versions of this
proposal easier to understand than the "Proposed alternative" versions.
Maybe it's just me.
I guess on top of that, do we need to standardize something that can be
pretty easily implemented in a couple lines?
--
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/049a1c8d-3b5f-436d-87af-cd1015ced3b5%40isocpp.org.
------=_Part_390_1945373559.1547137019393
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, January 10, 2019 at 9:34:17 AM UTC-6, Matthew=
Woehlke wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-=
left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">> - It cover=
s one use case out of 4 (a<b<c, a<b<=3Dc, a<=3Db<c, a<=
=3Db<=3Dc). It
<br>> makes sense, given the primary use case of clamping and the most c=
ommon
<br>> usage of "between" in English, for the one you've ch=
osen to be the default
<br>> (although having a default is often the cause of bugs - the line b=
etween
<br>> usability and assumption is often a blurry one).
<br>
<br>That could be fixed by the addition of an optional parameter to specify
<br>which bounds (upper, lower, both) are inclusive, with the default being
<br>"neither". That may be a good addition.
<br></blockquote><div><br></div><div>=C2=A0I feel like in case where my mid=
dle is an expression, I'd much rather write:</div><div><br></div><div><=
div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bo=
rder-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; ove=
rflow-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><font color=3D"#000000"><span style=3D"color: #660;" class=3D"style=
d-by-prettify">[&]{</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">auto</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&&</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> e </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> some</span><span style=3D"color: #660;" class=3D"styled-by-prettify">-</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">complex</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">-</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">expr</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">return</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> lo </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> e </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">&&</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> e </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> hi</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">}();</span></fo=
nt></div></code></div><div><br></div><div><br></div><div>Than whatever I wo=
uld have to do:<br></div></div><div><br></div><div><div class=3D"prettyprin=
t" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 18=
7, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word;=
"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"=
color: #000;" class=3D"styled-by-prettify">is_between</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">some</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">-</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">complex</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">-</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">expr</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,</span><font color=3D"#000000"><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> lo</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
hi</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> exclusive_lo</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> excusive_hi</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">// this?</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br></span></font><font color=3D"#00000=
0"><span style=3D"color: #000;" class=3D"styled-by-prettify">is_between</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">some</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">-</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">complex</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">-</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">expr</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> exclusive</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">lo</span><span style=3D"color: #660;" class=3D"styled-by-prettify">},</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> exclusive</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">hi</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">});</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" c=
lass=3D"styled-by-prettify">// or this?</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// or something else?</span></font></div></code></d=
iv><br>And in the case where I have a variable and not a complex expression=
, I have a hard time seeing the benefit. I find the "Now" version=
s of this proposal easier to understand than the "Proposed alternative=
" versions. Maybe it's just me.</div><div><br></div><div>I guess o=
n top of that, do we need to standardize something that can be pretty easil=
y implemented in a couple lines?</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/049a1c8d-3b5f-436d-87af-cd1015ced3b5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/049a1c8d-3b5f-436d-87af-cd1015ced3b5=
%40isocpp.org</a>.<br />
------=_Part_390_1945373559.1547137019393--
------=_Part_389_115616345.1547137019392--
.
Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Fri, 11 Jan 2019 12:13:35 -0500
Raw View
On 10/01/2019 11.16, Barry Revzin wrote:
> On Thursday, January 10, 2019 at 9:34:17 AM UTC-6, Matthew Woehlke wrote:
>> That could be fixed by the addition of an optional parameter to specify
>> which bounds (upper, lower, both) are inclusive, with the default being
>> "neither". That may be a good addition.
>
> I feel like in case where my middle is an expression, I'd much rather
> write:
>
> [&]{
> auto&& e = some-complex-expr;
> return lo < e && e < hi;
> }();
>
> Than whatever I would have to do:
>
> is_between(some-complex-expr, lo, hi, exclusive_lo, excusive_hi); // this?
> is_between(some-complex-expr, exclusive{lo}, exclusive{hi}); // or this?
> // or something else?
I was thinking more along the lines of:
is_between(lo, expr, hi) // note: default == std::exclusive
is_between(lo, expr, hi, std::lower_inclusive)
is_between(lo, expr, hi, std::upper_inclusive)
is_between(lo, expr, hi, std::inclusive)
....although having an std::inclusive{bound} is an interesting idea.
> I guess on top of that, do we need to standardize something that can be
> pretty easily implemented in a couple lines?
Well, we have std::min, std::max, std::clamp... I guess it comes down to
whether this is something that's needed often enough to justify
standardizing. I'll punt on trying to answer that :-).
--
Matthew
--
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/6a1806fa-f176-db2d-9c6a-16958440032c%40gmail.com.
.
Author: =?UTF-8?Q?Johel_Ernesto_Guerrero_Pe=C3=B1a?= <johelegp@gmail.com>
Date: Sat, 12 Jan 2019 09:26:32 -0800 (PST)
Raw View
------=_Part_1083_461287632.1547313993113
Content-Type: multipart/alternative;
boundary="----=_Part_1084_1503706366.1547313993113"
------=_Part_1084_1503706366.1547313993113
Content-Type: text/plain; charset="UTF-8"
On Wednesday, January 9, 2019 at 2:22:52 PM UTC-4, Ray Hamel wrote:
>
> Might it be more useful to return an ordering instead of a bool?
>
> -Ray
>
Sounds sensible. I have posed it as a poll. There are still papers inflight
about changing those, like https://wg21.link/P1307, and new additions like
the concept-constrained comparisons (https://wg21.link/range.cmp) that
don't use them. For the latter, I have opened CaseyCarter/papers#1
<https://github.com/CaseyCarter/papers/issues/1>.
As for using clamp in the name, or the bounds being a closed range, I
believe this was set in stone once C++17 was published as an official ISO
standard with the clamp algorithm (https://wg21.link/alg.clamp) as proposed
by https://wg21.link/P0025. is_clamped is to clamp what is_sorted is to sort
..
Thanks for your answers. I have reflected them and my conclusion in the
proposal. And sorry for the delay, but my replies were being filtered.
--
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/693c93b1-38e3-4109-a053-9b41d1965231%40isocpp.org.
------=_Part_1084_1503706366.1547313993113
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, January 9, 2019 at 2:22:52 PM UTC-4, Ray Ham=
el wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: =
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Might it be more usef=
ul to return an ordering instead of a bool?<p>-Ray</p></blockquote><div><br=
></div><div><div>Sounds sensible. I have posed it as a poll. There are stil=
l papers=20
inflight about changing those, like <a href=3D"https://wg21.link/P1307" tar=
get=3D"_blank" data-saferedirecturl=3D"https://www.google.com/url?q=3Dhttps=
://wg21.link/P1307&source=3Dgmail&ust=3D1547399039975000&usg=3D=
AFQjCNH9sUFrT9fzCYVZnllF9i4TPUL2kg">https://wg21.link/P1307</a>, and new=20
additions like the concept-constrained comparisons=20
(<a href=3D"https://wg21.link/range.cmp" target=3D"_blank" data-saferedirec=
turl=3D"https://www.google.com/url?q=3Dhttps://wg21.link/range.cmp&sour=
ce=3Dgmail&ust=3D1547399039975000&usg=3DAFQjCNGBNnSs1rrZ-a8cm4GrKNj=
bs_EpSA">https://wg21.link/range.cmp</a>) that don't use them. For the =
latter, I have opened <a href=3D"https://github.com/CaseyCarter/papers/issu=
es/1" target=3D"_blank" data-saferedirecturl=3D"https://www.google.com/url?=
q=3Dhttps://github.com/CaseyCarter/papers/issues/1&source=3Dgmail&u=
st=3D1547399039975000&usg=3DAFQjCNEJUWvzBe0oSapW_WS_yJJ5Q-SSUg">CaseyCa=
rter/papers#1</a>.</div><div><br></div><div>As for using <span style=3D"fon=
t-family:courier new,monospace">clamp</span>
in the name, or the bounds being a closed range, I believe this was set
in stone once C++17 was published as an official ISO standard with the <sp=
an style=3D"font-family:courier new,monospace">clamp</span> algorithm (<a h=
ref=3D"https://wg21.link/alg.clamp" target=3D"_blank" data-saferedirecturl=
=3D"https://www.google.com/url?q=3Dhttps://wg21.link/alg.clamp&source=
=3Dgmail&ust=3D1547399039975000&usg=3DAFQjCNHhL7uP0BxcCzF0EjI5IQSbI=
52svQ">https://wg21.link/alg.clamp</a>) as proposed by <a href=3D"https://w=
g21.link/P0025" target=3D"_blank" data-saferedirecturl=3D"https://www.googl=
e.com/url?q=3Dhttps://wg21.link/P0025&source=3Dgmail&ust=3D15473990=
39975000&usg=3DAFQjCNFMggY-tPi6VHCze0yLznphXkmgJQ">https://wg21.link/P0=
025</a>. <span style=3D"font-family:courier new,monospace">is_clamped</span=
> is to <span style=3D"font-family:courier new,monospace">clamp</span> what=
<span style=3D"font-family:courier new,monospace">is_sorted</span> is to <=
span style=3D"font-family:courier new,monospace">sort</span>.</div><div><br=
></div>Thanks for your answers. I have reflected them and my conclusion in =
the proposal. And sorry for the delay, but my replies were being filtered.<=
br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/693c93b1-38e3-4109-a053-9b41d1965231%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/693c93b1-38e3-4109-a053-9b41d1965231=
%40isocpp.org</a>.<br />
------=_Part_1084_1503706366.1547313993113--
------=_Part_1083_461287632.1547313993113--
.
Author: marc.glisse@gmail.com
Date: Sun, 13 Jan 2019 06:15:45 -0800 (PST)
Raw View
------=_Part_1335_1459807640.1547388945809
Content-Type: multipart/alternative;
boundary="----=_Part_1336_389983485.1547388945810"
------=_Part_1336_389983485.1547388945810
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Saturday, January 12, 2019 at 6:26:33 PM UTC+1, Johel Ernesto Guerrero=
=20
Pe=C3=B1a wrote:
>
> On Wednesday, January 9, 2019 at 2:22:52 PM UTC-4, Ray Hamel wrote:
>>
>> Might it be more useful to return an ordering instead of a bool?
>>
>> -Ray
>>
>
> Sounds sensible. I have posed it as a poll. There are still papers=20
> inflight about changing those, like https://wg21.link/P1307, and new=20
> additions like the concept-constrained comparisons (
> https://wg21.link/range.cmp) that don't use them. For the latter, I have=
=20
> opened CaseyCarter/papers#1=20
> <https://github.com/CaseyCarter/papers/issues/1>.
>
> As for using clamp in the name, or the bounds being a closed range, I=20
> believe this was set in stone once C++17 was published as an official ISO=
=20
> standard with the clamp algorithm (https://wg21.link/alg.clamp) as=20
> proposed by https://wg21.link/P0025. is_clamped is to clamp what is_sorte=
d=20
> is to sort.
>
Is there any difference between is_clamped(b,a,c) and=20
ranges::is_sorted({a,b,c})? Just the name? Using operator<=3D instead of=20
negating operator<? is_sorted also lets you specify comp/proj.
--=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/d4724ad2-c471-40cb-8956-af01961e0754%40isocpp.or=
g.
------=_Part_1336_389983485.1547388945810
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Saturday, January 12, 2019 at 6:26:33 PM UTC+1, Johel E=
rnesto Guerrero Pe=C3=B1a 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">On Wednesday, January 9, 2019 at 2:22:52 PM UTC-4, Ray H=
amel wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:=
0.8ex;border-left:1px #ccc solid;padding-left:1ex">Might it be more useful =
to return an ordering instead of a bool?<p>-Ray</p></blockquote><div><br></=
div><div><div>Sounds sensible. I have posed it as a poll. There are still p=
apers=20
inflight about changing those, like <a href=3D"https://wg21.link/P1307" tar=
get=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'https://www=
..google.com/url?q\x3dhttps%3A%2F%2Fwg21.link%2FP1307\x26sa\x3dD\x26sntz\x3d=
1\x26usg\x3dAFQjCNGzal3mc3BDT-LBusGIRFrCUStEkg';return true;" onclick=
=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fwg21.lin=
k%2FP1307\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGzal3mc3BDT-LBusGIRFrCUSt=
Ekg';return true;">https://wg21.link/P1307</a>, and new=20
additions like the concept-constrained comparisons=20
(<a href=3D"https://wg21.link/range.cmp" target=3D"_blank" rel=3D"nofollow"=
onmousedown=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2=
F%2Fwg21.link%2Frange.cmp\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGgWfDR0rW=
Blp6eXe8WF3eYA_kgGw';return true;" onclick=3D"this.href=3D'https://=
www.google.com/url?q\x3dhttps%3A%2F%2Fwg21.link%2Frange.cmp\x26sa\x3dD\x26s=
ntz\x3d1\x26usg\x3dAFQjCNGgWfDR0rWBlp6eXe8WF3eYA_kgGw';return true;">ht=
tps://wg21.link/range.cmp</a>) that don't use them. For the latter, I h=
ave opened <a href=3D"https://github.com/CaseyCarter/papers/issues/1" targe=
t=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'https://www.g=
oogle.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FCaseyCarter%2Fpapers%2Fissues=
%2F1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGBGRHNay_SMamC_p9a6-jn5SbHaA&#=
39;;return true;" onclick=3D"this.href=3D'https://www.google.com/url?q\=
x3dhttps%3A%2F%2Fgithub.com%2FCaseyCarter%2Fpapers%2Fissues%2F1\x26sa\x3dD\=
x26sntz\x3d1\x26usg\x3dAFQjCNGBGRHNay_SMamC_p9a6-jn5SbHaA';return true;=
">CaseyCarter/papers#1</a>.</div><div><br></div><div>As for using <span sty=
le=3D"font-family:courier new,monospace">clamp</span>
in the name, or the bounds being a closed range, I believe this was set
in stone once C++17 was published as an official ISO standard with the <sp=
an style=3D"font-family:courier new,monospace">clamp</span> algorithm (<a h=
ref=3D"https://wg21.link/alg.clamp" target=3D"_blank" rel=3D"nofollow" onmo=
usedown=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fw=
g21.link%2Falg.clamp\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHFuWKfG_OqpXjf=
2Mi4u9bl_LlGvQ';return true;" onclick=3D"this.href=3D'https://www.g=
oogle.com/url?q\x3dhttps%3A%2F%2Fwg21.link%2Falg.clamp\x26sa\x3dD\x26sntz\x=
3d1\x26usg\x3dAFQjCNHFuWKfG_OqpXjf2Mi4u9bl_LlGvQ';return true;">https:/=
/wg21.link/alg.clamp</a>) as proposed by <a href=3D"https://wg21.link/P0025=
" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'https:=
//www.google.com/url?q\x3dhttps%3A%2F%2Fwg21.link%2FP0025\x26sa\x3dD\x26snt=
z\x3d1\x26usg\x3dAFQjCNF2oRapTo3YV7UtvSDDklVB97TJpg';return true;" oncl=
ick=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fwg21.=
link%2FP0025\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2oRapTo3YV7UtvSDDklVB=
97TJpg';return true;">https://wg21.link/P0025</a>. <span style=3D"font-=
family:courier new,monospace">is_clamped</span> is to <span style=3D"font-f=
amily:courier new,monospace">clamp</span> what <span style=3D"font-family:c=
ourier new,monospace">is_sorted</span> is to <span style=3D"font-family:cou=
rier new,monospace">sort</span>.</div></div></div></blockquote><div><br></d=
iv><div>Is there any difference between is_clamped(b,a,c) and ranges::is_so=
rted({a,b,c})? Just the name? Using operator<=3D instead of negating ope=
rator<? is_sorted also lets you specify comp/proj.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/d4724ad2-c471-40cb-8956-af01961e0754%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d4724ad2-c471-40cb-8956-af01961e0754=
%40isocpp.org</a>.<br />
------=_Part_1336_389983485.1547388945810--
------=_Part_1335_1459807640.1547388945809--
.
Author: Barry Revzin <barry.revzin@gmail.com>
Date: Sun, 13 Jan 2019 07:14:45 -0800 (PST)
Raw View
------=_Part_1297_478394266.1547392485592
Content-Type: multipart/alternative;
boundary="----=_Part_1298_1935713593.1547392485592"
------=_Part_1298_1935713593.1547392485592
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
On Sunday, January 13, 2019 at 8:15:45 AM UTC-6, marc....@gmail.com wrote:
>
> On Saturday, January 12, 2019 at 6:26:33 PM UTC+1, Johel Ernesto Guerrero=
=20
> Pe=C3=B1a wrote:
>>
>> On Wednesday, January 9, 2019 at 2:22:52 PM UTC-4, Ray Hamel wrote:
>>>
>>> Might it be more useful to return an ordering instead of a bool?
>>>
>>> -Ray
>>>
>>
>> Sounds sensible. I have posed it as a poll. There are still papers=20
>> inflight about changing those, like https://wg21.link/P1307, and new=20
>> additions like the concept-constrained comparisons (
>> https://wg21.link/range.cmp) that don't use them. For the latter, I have=
=20
>> opened CaseyCarter/papers#1=20
>> <https://github.com/CaseyCarter/papers/issues/1>.
>>
>> As for using clamp in the name, or the bounds being a closed range, I=20
>> believe this was set in stone once C++17 was published as an official IS=
O=20
>> standard with the clamp algorithm (https://wg21.link/alg.clamp) as=20
>> proposed by https://wg21.link/P0025. is_clamped is to clamp what=20
>> is_sorted is to sort.
>>
>
> Is there any difference between is_clamped(b,a,c) and=20
> ranges::is_sorted({a,b,c})? Just the name? Using operator<=3D instead of=
=20
> negating operator<? is_sorted also lets you specify comp/proj.
>
There is no ranges::is_sorted. At least not yet? But if such a thing were=
=20
to compile, it'd probably take an initializer_list<T>, which means you're=
=20
copying a, b, and c there - which we don't necessarily want to do. That's=
=20
a win for is_clamped().=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/b8c77981-926d-424b-9aa6-6e751d31635a%40isocpp.or=
g.
------=_Part_1298_1935713593.1547392485592
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, January 13, 2019 at 8:15:45 AM UTC-6, marc....@=
gmail.com 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"lt=
r">On Saturday, January 12, 2019 at 6:26:33 PM UTC+1, Johel Ernesto Guerrer=
o Pe=C3=B1a wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margi=
n-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">=
On Wednesday, January 9, 2019 at 2:22:52 PM UTC-4, Ray Hamel wrote:<blockqu=
ote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1=
px #ccc solid;padding-left:1ex">Might it be more useful to return an orderi=
ng instead of a bool?<p>-Ray</p></blockquote><div><br></div><div><div>Sound=
s sensible. I have posed it as a poll. There are still papers=20
inflight about changing those, like <a href=3D"https://wg21.link/P1307" rel=
=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D'https://www=
..google.com/url?q\x3dhttps%3A%2F%2Fwg21.link%2FP1307\x26sa\x3dD\x26sntz\x3d=
1\x26usg\x3dAFQjCNGzal3mc3BDT-LBusGIRFrCUStEkg';return true;" onclick=
=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fwg21.lin=
k%2FP1307\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGzal3mc3BDT-LBusGIRFrCUSt=
Ekg';return true;">https://wg21.link/P1307</a>, and new=20
additions like the concept-constrained comparisons=20
(<a href=3D"https://wg21.link/range.cmp" rel=3D"nofollow" target=3D"_blank"=
onmousedown=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2=
F%2Fwg21.link%2Frange.cmp\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGgWfDR0rW=
Blp6eXe8WF3eYA_kgGw';return true;" onclick=3D"this.href=3D'https://=
www.google.com/url?q\x3dhttps%3A%2F%2Fwg21.link%2Frange.cmp\x26sa\x3dD\x26s=
ntz\x3d1\x26usg\x3dAFQjCNGgWfDR0rWBlp6eXe8WF3eYA_kgGw';return true;">ht=
tps://wg21.link/range.cmp</a>) that don't use them. For the latter, I h=
ave opened <a href=3D"https://github.com/CaseyCarter/papers/issues/1" rel=
=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D'https://www=
..google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FCaseyCarter%2Fpapers%2Fissu=
es%2F1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGBGRHNay_SMamC_p9a6-jn5SbHaA=
';return true;" onclick=3D"this.href=3D'https://www.google.com/url?=
q\x3dhttps%3A%2F%2Fgithub.com%2FCaseyCarter%2Fpapers%2Fissues%2F1\x26sa\x3d=
D\x26sntz\x3d1\x26usg\x3dAFQjCNGBGRHNay_SMamC_p9a6-jn5SbHaA';return tru=
e;">CaseyCarter/papers#1</a>.</div><div><br></div><div>As for using <span s=
tyle=3D"font-family:courier new,monospace">clamp</span>
in the name, or the bounds being a closed range, I believe this was set
in stone once C++17 was published as an official ISO standard with the <sp=
an style=3D"font-family:courier new,monospace">clamp</span> algorithm (<a h=
ref=3D"https://wg21.link/alg.clamp" rel=3D"nofollow" target=3D"_blank" onmo=
usedown=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fw=
g21.link%2Falg.clamp\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHFuWKfG_OqpXjf=
2Mi4u9bl_LlGvQ';return true;" onclick=3D"this.href=3D'https://www.g=
oogle.com/url?q\x3dhttps%3A%2F%2Fwg21.link%2Falg.clamp\x26sa\x3dD\x26sntz\x=
3d1\x26usg\x3dAFQjCNHFuWKfG_OqpXjf2Mi4u9bl_LlGvQ';return true;">https:/=
/wg21.link/alg.clamp</a>) as proposed by <a href=3D"https://wg21.link/P0025=
" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D'https:=
//www.google.com/url?q\x3dhttps%3A%2F%2Fwg21.link%2FP0025\x26sa\x3dD\x26snt=
z\x3d1\x26usg\x3dAFQjCNF2oRapTo3YV7UtvSDDklVB97TJpg';return true;" oncl=
ick=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fwg21.=
link%2FP0025\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF2oRapTo3YV7UtvSDDklVB=
97TJpg';return true;">https://wg21.link/P0025</a>. <span style=3D"font-=
family:courier new,monospace">is_clamped</span> is to <span style=3D"font-f=
amily:courier new,monospace">clamp</span> what <span style=3D"font-family:c=
ourier new,monospace">is_sorted</span> is to <span style=3D"font-family:cou=
rier new,monospace">sort</span>.</div></div></div></blockquote><div><br></d=
iv><div>Is there any difference between is_clamped(b,a,c) and ranges::is_so=
rted({a,b,c})? Just the name? Using operator<=3D instead of negating ope=
rator<? is_sorted also lets you specify comp/proj.<br></div></div></bloc=
kquote><div><br></div><div>There is no ranges::is_sorted. At least not yet?=
But if such a thing were to compile, it'd probably take an initializer=
_list<T>, which means you're copying a, b, and c there - which we=
don't necessarily want to do.=C2=A0 That's a win for is_clamped().=
=C2=A0</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/b8c77981-926d-424b-9aa6-6e751d31635a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b8c77981-926d-424b-9aa6-6e751d31635a=
%40isocpp.org</a>.<br />
------=_Part_1298_1935713593.1547392485592--
------=_Part_1297_478394266.1547392485592--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Sun, 13 Jan 2019 17:18:09 +0200
Raw View
On Sun, 13 Jan 2019 at 17:14, Barry Revzin <barry.revzin@gmail.com> wrote:
>> Is there any difference between is_clamped(b,a,c) and ranges::is_sorted({a,b,c})? Just the name? Using operator<= instead of negating operator<? is_sorted also lets you specify comp/proj.
> There is no ranges::is_sorted. At least not yet?
[is.sorted] in the current working draft disagrees with you.
--
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/CAFk2RUaJurCoWQKQU%2B%3DZ02w%3Dqh9wksLUVODRmrvG%3D6i0OqBwkg%40mail.gmail.com.
.
Author: Barry Revzin <barry.revzin@gmail.com>
Date: Sun, 13 Jan 2019 09:56:27 -0600
Raw View
--0000000000004e4e5a057f58f910
Content-Type: text/plain; charset="UTF-8"
On Sun, Jan 13, 2019, 9:18 AM Ville Voutilainen <ville.voutilainen@gmail.com>
wrote:
> On Sun, 13 Jan 2019 at 17:14, Barry Revzin <barry.revzin@gmail.com> wrote:
>
> >> Is there any difference between is_clamped(b,a,c) and
> ranges::is_sorted({a,b,c})? Just the name? Using operator<= instead of
> negating operator<? is_sorted also lets you specify comp/proj.
> > There is no ranges::is_sorted. At least not yet?
>
> [is.sorted] in the current working draft disagrees with you.
>
That's some reading comprehension fail right there :facepalm:
Lemme rephrase. ranges::is_sorted({a,b c}) doesn't compile. In order for it
to, either we'd have to add an overload for initializer_list<T> or you'd
have to explicitly create one. And then the rest of my comment still holds.
>
--
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/CACS8nve4T1u0nUcy6dqbh_7-2JM2YDsCT2UxNqW2O7aSL%2B8_zQ%40mail.gmail.com.
--0000000000004e4e5a057f58f910
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div class=3D"gmail_quote"><div dir=3D"ltr">On Sun, Jan 13, 2019, 9:18 AM V=
ille Voutilainen <<a href=3D"mailto:ville.voutilainen@gmail.com">ville.v=
outilainen@gmail.com</a>> wrote:<br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
>On Sun, 13 Jan 2019 at 17:14, Barry Revzin <<a href=3D"mailto:barry.rev=
zin@gmail.com" target=3D"_blank">barry.revzin@gmail.com</a>> wrote:<br>
<br>
>> Is there any difference between is_clamped(b,a,c) and ranges::is_s=
orted({a,b,c})? Just the name? Using operator<=3D instead of negating op=
erator<? is_sorted also lets you specify comp/proj.<br>
> There is no ranges::is_sorted. At least not yet?<br>
<br>
[is.sorted] in the current working draft disagrees with you.<br></blockquot=
e></div><div><br></div><div>That's some reading comprehension fail righ=
t there :facepalm:</div><div><br></div><div>Lemme rephrase. ranges::is_sort=
ed({a,b c}) doesn't compile. In order for it to, either we'd have t=
o add an overload for initializer_list<T> or you'd have to explic=
itly create one. And then the rest of my comment still holds.</div><div cla=
ss=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 =
..8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CACS8nve4T1u0nUcy6dqbh_7-2JM2YDsCT2Ux=
NqW2O7aSL%2B8_zQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACS8nve4T1u0nU=
cy6dqbh_7-2JM2YDsCT2UxNqW2O7aSL%2B8_zQ%40mail.gmail.com</a>.<br />
--0000000000004e4e5a057f58f910--
.