https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96733
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:741c7350c08b0884689466867b6c9e711c7b109e commit r12-4061-g741c7350c08b0884689466867b6c9e711c7b109e Author: Jonathan Wakely <jwak...@redhat.com> Date: Sat Apr 17 22:34:09 2021 +0100 libstdc++: Implement std::clamp with std::min and std::max [PR 96733] The compiler doesn't know about the precondition of std::clamp that (hi < lo) is false, and so can't optimize as well as we'd like. By using std::min and std::max we help the compiler. Signed-off-by: Jonathan Wakely <jwak...@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/96733 * include/bits/stl_algo.h (clamp): Use std::min and std::max.