Mar 8, 2014 at 6:57pm
Templates must be defined inline in the header file, otherwise the compiler cannot see the definition to instantiate the template with.
Apr 21, 2014 at 10:39pm
you wrote typeid(T)
i dont think that is possible because "T" is just a placeholder for a variable type
for eg:
template <class T>
T add(T a1, T a2)
{
return a1+a2;
}
where a1 and a2 can be a int, double, char, float or whatever variable type.
so basically typeid(T) is just passing a variable type T
Apr 21, 2014 at 10:56pm
@geosnipes: there is nothing at all wrong with typeid(T)
Apr 21, 2014 at 11:20pm
> typeid(*(Pro*)v.at(i))
¿why are you casting?
> a method based on the type passed
> return os << obj.getNum();
¿where are you passing the type?