std.algo.cmp.clamp

* Returns and Params for clamp

another fix

quickfur

review fixes

underscore
This commit is contained in:
Robert burner Schadek 2015-03-19 00:07:10 +01:00 committed by Robert burner Schadek
parent eba63621c6
commit fbf42b4b73

View file

@ -475,10 +475,19 @@ unittest
)());
}
/**
Returns $(D val), if it is between $(D lower) and $(D upper).
Otherwise returns the nearest of the two. Equivalent to $(D max(lower,
min(upper,val))).
/** Clamps a value into the given bounds.
This functions is equivalent to $(D max(lower, 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)
in