Topic: std::max not inheriting std::binary_function
Author: "Mark D. Rintoul" <rintoul@sandia.gov>
Date: 1999/08/24 Raw View
Recently, I had the need to use std::max in a number of
STL algorithms that used binary functions. I was surprised
to see that the implementation I was using (SGI STL 3.2)
did not implement std::max as a functor which inherited
std::binary_function (like similar functors such as std::plus)
but as a simple template function. I checked the standard and
this was the case there also. This greatly reduces its
usefulness in STL functions. It is easy enough to write your
own functor for max which has the desired behavior, but I was
curious why std::max was not implemented this was in the
standard.
As long as we are on the subject, why isn't the
global function std::make_pair also implemented as a functor
inheriting std::binary_function?
Mark Rintoul
rintoul@sandia.gov
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]