[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(catching up on my Email)
> > Very, very weird is the fact that the template functions min
> > and max are NOT
> > defined in the header algortihms.h as they should be. The best I get in
> > cstdlib is this:
> Have a look in <xutility>, they are defined there. <algorithms> includes
No, they are not, not in the MS CV++ version of xutility. Rather, the min
and max functions has been replaced by the functions _cpp_min and _cpp_max.
Defines are made so that _MIN and _MAX can be used instead.
The reason for this is that windows defines its own min and max in a header
This is where it happens there:
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
Now, these are macros. In other words, they do not do the job as one would
expect min() and max() to do. Think min(val++, val2).