190. min() and max() functions should be std::binary_functions

Section: 27.8.9 [alg.min.max] Status: NAD Submitter: Mark Rintoul Opened: 1999-08-26 Last modified: 2016-01-28 10:19:27 UTC

Priority: Not Prioritized

View all other issues in [alg.min.max].

View all issues with NAD status.


Both std::min and std::max are defined as template functions. This is very different than the definition of std::plus (and similar structs) which are defined as function objects which inherit std::binary_function.

This lack of inheritance leaves std::min and std::max somewhat useless in standard library algorithms which require a function object that inherits std::binary_function.

[ post Bellevue: Alisdair requested to re-Open. ]

[ 2009-07 Frankfurt ]

C++0x has lambdas to address this problem now.

Moved to NAD.


Although perhaps an unfortunate design decision, the omission is not a defect in the current standard.  A future standard may wish to consider additional function objects.