Función de plantilla y orden de llamada no de función de plantilla
En Linux obtengo
template max() is called
Pero bajo Windows me sale
non-template max() is called
¿Por qué? En Linux, uso gcc 4.5 y en Windows uso 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;
}