
26 Sep
2011
26 Sep
'11
3:41 p.m.
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);