
On Feb 22, 2011, at 11:54 PM, Тимофей Игнатьич wrote:
I wasn't able to find a clamp function in boost so i submitted my version for discussion and refinement here: http://www.boostpro.com/vault/index.php?&direction=0&order=&directory=Algorithms (file clamp.hpp)
Summary: clamp(a, x, b) Effect: if (x < a) returns a, otherwise if (b < x) returns b, otherwise returns x.
clamp(a, x, b, comp) clamp<comp>(a, x, b) Effect: if comp(x, a) returns a, otherwise if comp(b, x) returns b, otherwise returns x.
I have one in my (soon to be proposed) Boost.Algorithm library. Interesting that you were successful at uploading to the vault. I have been stymied by that :-( ] Here's my version - it appears to be basically the same as yours. ;-) -- 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