For Programmers: Free Programming Magazines  


Home > Archive > VC STL > February 2005 > std::min()









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author std::min()
Andrew Chalk

2005-02-14, 9:11 pm

Does VC7.1 not implement std::min()? It is not in <algorithm>, which is
where it apparently should be.

Many thanks.


Doug Harrison [MVP]

2005-02-14, 9:11 pm

Andrew Chalk wrote:

>Does VC7.1 not implement std::min()? It is not in <algorithm>, which is
>where it apparently should be.


It's there provided the min/max macros aren't defined. If you're using
<windows.h>, make sure you #define NOMINMAX with the /D compiler option or
before you #include <windows.h>

--
Doug Harrison
Microsoft MVP - Visual C++
Pete Becker

2005-02-14, 9:11 pm

Andrew Chalk wrote:
> Does VC7.1 not implement std::min()? It is not in <algorithm>, which is
> where it apparently should be.
>


This compiles just fine:

#include <algorithm>

int test(int a, int b)
{
return std::min(a, b);
}

If you're reading the header files to figure out what's where you'll
have to dig a little deeper, down into <xutility>.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Andrew Chalk

2005-02-14, 9:11 pm

Thanks!
"Doug Harrison [MVP]" <dsh@mvps.org> wrote in message
news:ce3t01ddq9vpdv90h398rg3tihtbbdac5i@
4ax.com...
> Andrew Chalk wrote:
>
>
> It's there provided the min/max macros aren't defined. If you're using
> <windows.h>, make sure you #define NOMINMAX with the /D compiler option or
> before you #include <windows.h>
>
> --
> Doug Harrison
> Microsoft MVP - Visual C++



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com