PicoBlog

Daily bit(e) of C++ | std::min, std::max, std::minmax

The min-max algorithms are relatively simple but offer multiple overloads suitable for different use cases.

In C++11, the std::minmax algorithm was added to std::min and std::max, and all three algorithms received an overload for std::initializer_list.

C++20 introduced corresponding versions in the std::ranges namespace and a new overload that operates on a range.

Leave a comment

ncG1vNJzZmirmaK8r8DOrZ9nq6WXwLWtwqRlnKedZL1wsMCio7Jlkp7BpnnOn2ScZaOpsa61zWaqrZydlsVuv9OdpKKmnZbF

Christie Applegate

Update: 2024-12-03