
On Sep 24, 2011, at 7:31 AM, Olaf van der Spek wrote:
On Fri, Sep 23, 2011 at 6:21 PM, Phil Endecott <spam_from_boost_dev@chezphil.org> wrote:
template<typename V> V clamp ( V val, V lo, V hi );
I have a clamp function that orders the args low - middle - high, which seems like a more natural ordering to me. Is there some rationale or precedent for this middle - low - high ordering? I think the confusion
lo and hi will often be short literals, while val might be longer. Having lo and hi close together seems like a good idea. If val is really long, it might even be better to have lo and hi before val, as is sometimes seen with (if X == f()) where X is a constant.
I note that this function takes its args by value, while std::min & max take const references. What is the rationale for this?
Probably just an oversight.
Indeed. I'm keeping track of issues at Github, and this one is there: https://github.com/mclow/Boost.Algorithm/issues/7 Feel free to add your own issues there (Brent has already done so). -- Marshall Marshall Clow Idio Software <mailto:mclow.lists@gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki