cpp/algorithm/clamp

@1@ If compares less than, returns ; otherwise if  compares less than , returns ; otherwise returns. @@ Uses operator< to compare the values. @2@ Same as, but uses to compare the values.

The behavior is undefined if the value of is greater than.

Return value
Reference to if  is less than, reference to  if  is less than , otherwise reference to.

Complexity
At most two comparisons.