why this programme cannot be built in vc6(there are two link error),but
successful in gcc or vc7?

------------------
#include <iostream>
#include <algorithm>

template <class T>
inline bool less(T _a, T _b)
{
return _a < _b;
}

int main(void)
{
int a[10] = {65, 23, 654, 87, 12, 56, 231, 15, 58, 78};
std::sort(a, a + 10, ::less<int>);
return 0;
}

------------------

And this is successful in vc6 and vc7 and gcc:

------------------
#include <iostream>
#include <algorithm>

inline bool less(int _a, int _b)
{
return _a < _b;
}

int main(void)
{
int a[10] = {65, 23, 654, 87, 12, 56, 231, 15, 58, 78};
std::sort(a, a + 10, ::less);
return 0;
}

------------------

Re: About the third parameter of std::sort in VC6. by Carl

Carl
Tue Jun 07 22:37:54 CDT 2005

77123036@163.com wrote:
> why this programme cannot be built in vc6(there are two link
> error),but successful in gcc or vc7?

Becuase VC6 is 7 years old, nearly 3 versions out of date, and quite
dificient in it's handling of templates.

-cd