Ver Mensaje Individual
  #1  
Antiguo 07-03-2012
waremovil waremovil is offline
Miembro
 
Registrado: ago 2007
Ubicación: Zaragoza
Posts: 78
Reputación: 17
waremovil Va por buen camino
template typename falla

Hola compañeros, vengo de nuevo con problemas, esta vez más relacionados con c++ estándar.

Estoy intentando utilizar la característica de templates. Tengo la siguiente función:

Código:
        template <typename T>
        int valida( T value, int var2 )
        {
                if( typeid(T) == typeid(int))
                {
                    if( value < var2 )
                    {
                         ...
                    }    
        }
    }
Esto me salta en tiempo de compilación y me dice textualmente:
Código:
[BCC32 Error] E2094 'operator<' not implemented in type 'string' for arguments of type 'int'
¿Por qué me interpreta "value" como un string si es de tipo indefinido (template) ?? ¿qué hago mal?

1000gracias
__________________
http://www.qdsSoftware.com
Responder Con Cita