In a function within a template class, I'm trying to distinguish between primitive types and others.
In c++ 11 you can do:
if(std::is_fundamental<T>::value)
{
// Treat it as a primitive
}
else
{
//Treat it otherwise
}
Please correct me if I'm wrong and this is not only in c++ 11.
Is there an alternative to this in earlier versions of c++?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…