Boost logo

Boost :

From: Alberto Barbati (abarbati_at_[hidden])
Date: 2004-02-25 03:27:45


Eric Niebler wrote:

> Was that a vote in favor of an interval_min function, or a boost-wide
> utility? If we want a boost-wide utility (a good thing to have, IMO),
> what should it be called? boost::boost_min (kind of repetitive)? or
> perhaps boost::dependent_min to emphasize the fact that is uses Koenig
> lookup? Or just boost::min_?

Why not having both std::min and "dependent" min:

#define BOOST_EMPTY

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

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

possibly adding suitable workarounds for implementation that put min in
the global namespace. I like the idea of having those as boost-wide
utilities. I think that std_min(x, y) is nicer and more descriptive to
read than (min)(x, y), but that's my personal taste. The separate name
dependent_min make it self-evident even to the causal reader that it's
something different from std::min/std_min.

Just my €0.01

Alberto Barbati


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