-Ray
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-proposal...@isocpp.org.
To post to this group, send email to std-pr...@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-proposal...@isocpp.org.
To post to this group, send email to std-pr...@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.
> - 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.
[&]{
auto&& e = some-complex-expr;
return lo < e && e < hi;
}();
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?
Might it be more useful to return an ordering instead of a bool?-Ray
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.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.