Boost logo

Boost :

Subject: Re: [boost] [Review:Algorithms] Order of args to clamp
From: Andrew Sutton (asutton.list_at_[hidden])
Date: 2011-09-24 16:58:25

> Some quick comments about the proposed clamp() function:
>  template<typename V>
>  V clamp ( V val, V lo, V hi );

Like min and max, you might consider algorithms that clamp ranges of
values to a lo/hi pair. You could have clamp() that takes an
initializer list and clamp_range that takes a pair of iterators. Of
course, those would work in-place, so I wonder if Jefferey's
suggestion for an in-place variant on a single value might also be

That might give some other data points for thinking about the design
of the interface.

Personally, I think what you have now is the right signature.

Boost list run by bdawes at, gregod at, cpdaniel at, john at