https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105695
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Richard Biener from comment #2) > <algorithm> is required pre C++11 for std::swap. Right, it got moved to <utility> for C++11. GCC 10 uses C++98 so needs <algorithm> for std::swap. As noted at https://gcc.gnu.org/gcc-12/porting_to.html both <utility> and <algorithm> are less widely used inside libstdc++, so you are less likely to get those headers transitively by including other library headers.