Merge pull request #3070 from burner/algo_cmp_clamp

std.algo.cmp.clamp docu
This commit is contained in:
H. S. Teoh 2015-03-20 08:59:14 -07:00
commit 25b769ceff

View file

@ -484,10 +484,19 @@ unittest
)()); )());
} }
/** /** Clamps a value into the given bounds.
Returns $(D val), if it is between $(D lower) and $(D upper).
Otherwise returns the nearest of the two. Equivalent to $(D max(lower, This functions is equivalent to $(D max(lower, min(upper,val))).
min(upper,val))).
Params:
val = The value to _clamp.
lower = The _lower bound of the _clamp.
upper = The _upper bound of the _clamp.
Returns:
Returns $(D val), if it is between $(D lower) and $(D upper).
Otherwise returns the nearest of the two.
*/ */
auto clamp(T1, T2, T3)(T1 val, T2 lower, T3 upper) auto clamp(T1, T2, T3)(T1 val, T2 lower, T3 upper)
in in