I am trying to implement static cast. I need to check if the types T and U are implicitly convertible, if not check if one inherites from another. I can write a class to check each on of them, but I cant understand how to check implicit convert and if it doesnt compile check the inheritance.
all the checking need to on at compile time
You could use
type_traits
and in particularstd::is_convertible
in combination withstd::is_base_of
:Live Demo