Managed C++ Type Questions
I was reviewing some managed C++ in our codespace and I spotted this little gem:
template <typename T1, typename T2>
inline bool istypeof ( T2* t )
{
return (dynamic_cast<T1*>(t) != 0);
}
which I snagged from
msdn a while back. This nice chunk of code can be used in a context like this:
if (istypeof<OcrImageRegion>(myRegion)) { ... }
which is just a nice way to make your code readable from a C++ standpoint.