standard std::min/max use crefs for passing arguments. such behaviour isn't optimal for primitive types. so called call_traits ( vide boost ) could improve std:: algorithms.
e.g.: #include <algorithm> #include <boost/call_traits.hpp> long foo( long x, long y ) { return std::max( x, y ); } template < typename T > typename boost::call_traits< T >::param_type boosted_max( typename boost::call_traits< T >::param_type x, typename boost::call_traits< T >::param_type y ) { return ( x > y ? x : y ); } long bar( long x, long y ) { return boosted_max< long >( x, y ); } foo(long, long): leaq -16(%rsp), %rax #, tmp63 leaq -8(%rsp), %rdx #, tmp64 cmpq %rsi, %rdi # y, movq %rdi, -8(%rsp) # x, x movq %rsi, -16(%rsp) # y, y cmovge %rdx, %rax # tmp64,, tmp63 movq (%rax), %rax #, tmp62 ret bar(long, long): cmpq %rdi, %rsi # x, y cmovge %rsi, %rdi # y,, x movq %rdi, %rax # x, <result> ret are there any plans of implementing call_traits in std::(trX) ? -- Summary: unoptimal std::min/max (missed call_traits). Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30261