Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-02-25 12:59:11


Alberto Barbati wrote:
> Why not having both std::min and "dependent" min:

Sometimes less is more, and I have the feeling this is one of those
times. The subtle problem with your scheme is that most people would use
the std_min function over the dependent_min fucntion, so most people
would be disabling Koenig lookup and not even knowing.

If Koenig lookup would select a different overload, then in all
likelihood that's the correct function to call. My preference is to
provide one function, call it std_min, that uses Koenig lookup. If
someone really wants to disable Koenig lookup, then they need to do
something explicit, which is as it should be, IMO.

#define BOOST_EMPTY

template< class T >
inline T const & const std_min(T const &a, T const &b)
{
     using std::min;
     return min BOOST_EMPTY (a, b);
}

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk