Daily bit(e) of C++ | std::clamp
Daily bit(e) of C++ #286, The C++17 algorithm for clamping values between thresholds: std::clamp.
The std::clamp is a simple C++17 algorithm that clamps a given value between the minimum and maximum thresholds.
If the value is outside the thresholds, the violated threshold is returned instead.