7
77123036
why this programme cannot be built in vc6(there are two link error),but
successful in gcc?
------------------
#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 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;
}
------------------
successful in gcc?
------------------
#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 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;
}
------------------