Template func und non template func Aufrufreihenfolge
In Linux bekomme ich
template max() is called
Aber unter Windows bekomme ich
non-template max() is called
Warum? Unter Linux verwende ich gcc 4.5 und unter Windows VS2008.
#include <iostream>
#include <vector>
template < typename T >
inline void max( const int& a, const T& b )
{
std::cout << "template max() is called" << std::endl;
}
template < typename T >
inline void Imax( const int& a, const std::vector<T>& b)
{
max(a, b[0]);
}
inline void max( const int& a, const int& b )
{
std::cout << "non-template max() is called" << std::endl;
}
int main()
{
std::vector<int> v;
v.push_back(1);
Imax(1, v);
return 0;
}