M
Marcin Kalicinski
Is there a way, using template metaprogramming techinques like e.g. SFINAE,
to determine at compile time if a type supports certain operation (for
example if operator == is defined for that type)?
// Function for types supporting ==
template<class T> bool func(T t)
{
if (t == 3)
return true;
else
return false;
}
// Function for types not supporting ==
template<class T> bool func(T t)
{
return false;
}
Can I somehow make compiler call appropriate function depending on type of
T?
thanks,
Marcin
to determine at compile time if a type supports certain operation (for
example if operator == is defined for that type)?
// Function for types supporting ==
template<class T> bool func(T t)
{
if (t == 3)
return true;
else
return false;
}
// Function for types not supporting ==
template<class T> bool func(T t)
{
return false;
}
Can I somehow make compiler call appropriate function depending on type of
T?
thanks,
Marcin