cpp/algorithm/ranges/clamp

If compares less than, returns ; otherwise if  compares less than , returns ; otherwise returns.

The behavior is undefined if is greater than.

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

Complexity
At most two comparisons and three applications of the projection.