How to recognize type
-
hi guys
@template<class T>
static bool lessOrMoreThan(const T &, const T &,int lessOrMoreFlag)
{
if(lessOrMoreFlag == 0){
;
}
if(lessOrMoreFlag == 1){
;
}
}@if I pass QString or int in this template function, How can I know the exact type I passed in? thanks any comments
-
If you need to know the type of the template in a method, this is a strong sign of wrong design and that you most probably shouldn't use a template at all.
Can you describe what you want to achieve? Maybe we can come up with a better suitable and less problematic idea.