mirror of
https://github.com/dlang/phobos.git
synced 2025-05-02 08:00:48 +03:00
Merge pull request #3070 from burner/algo_cmp_clamp
std.algo.cmp.clamp docu
This commit is contained in:
commit
25b769ceff
1 changed files with 13 additions and 4 deletions
|
@ -484,10 +484,19 @@ unittest
|
||||||
)());
|
)());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** 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).
|
Returns $(D val), if it is between $(D lower) and $(D upper).
|
||||||
Otherwise returns the nearest of the two. Equivalent to $(D max(lower,
|
Otherwise returns the nearest of the two.
|
||||||
min(upper,val))).
|
|
||||||
*/
|
*/
|
||||||
auto clamp(T1, T2, T3)(T1 val, T2 lower, T3 upper)
|
auto clamp(T1, T2, T3)(T1 val, T2 lower, T3 upper)
|
||||||
in
|
in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue