Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-01-05 12:33:06

Dave Harris wrote:
> In my own Windows code I avoid the names min and max altogether. Would it
> be feasible to add a boost::Min and boost::Max ? That is, are there any
> situations like the struct foo where max is part of the published boost
> API?
> Are there any other "known ways" which should be considered before
> updating the boost source?

Well, at least one compiler for Win32 (VC++) supports the push_macro and
pop_macro pragmas, but I don't know about the others. That's one

Another possible work-around would be to assign std::min/max to a
function pointer before invoking it. But that would be uglier and
probably have more portability issues that simply wrapping the
identifier in parens. And it doesn't help when min/max are member
functions in a public interface.

A third possibility is to simply roll with it:
   using std::max;
   max(a,b); // could be the macro or std::max!
That would be the Taoist's approach. :-)

I can't think of any others. boost::Min/Max would be a possibility, but
personally I'd prefer to use std::min/max if we can at all help it.

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at