
On Sep 26, 2011, at 10:44 AM, Olaf van der Spek wrote:
On Mon, Sep 26, 2011 at 7:40 PM, Marshall Clow <mclow.lists@gmail.com> wrote:
clamp_range
Isn't it silly to define a transform range variant of every function that could be used to transform something?
is it? I'm asking for opinions here. When I pointed out (earlier) that clamp_range could be done with a single call to std::transform, I got: Someone else wrote:
I wrote:
It seems to me that a clamp_range is just:
std::transform ( begin, end, out, clamp ( _1, lo, hi ))
is that what you meant?
Sorry... this got lost in the thread. That looks like the right implementation, but it might be nice to provide an interface for it:
template<typename Iter, typename T> void clamp_range(Iter first, Iter last, cont T& high, const T& low)
template<typename T> void clamp_range(initialize_list<T> list, const T& high, const T& low);
There's a nearly infinite number of small algorithms that we _could_ write, but how to decide which ones are worth doing (and which ones should be done first) is a matter of opinion. -- 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