All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
safeTypeCompare.h File Reference

Safely compare C++ RTTI type structures. More...

+ Include dependency graph for safeTypeCompare.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool TfSafeTypeCompare (const std::type_info &t1, const std::type_info &t2)
 Safely compare std::type_info structures.
 
template<typename TO , typename FROM >
TO TfSafeDynamic_cast (FROM *ptr)
 Safely perform a dynamic cast.
 

Detailed Description

Safely compare C++ RTTI type structures.

Definition in file safeTypeCompare.h.

Function Documentation

◆ TfSafeDynamic_cast()

TO TfSafeDynamic_cast ( FROM *  ptr)

Safely perform a dynamic cast.

Usage should mirror regular dynamic_cast:

Derived* d = TfSafeDynamic_cast<Derived*>(basePtr);

Note that this function also works with TfRefPtr and TfWeakPtr managed objects.

Definition at line 38 of file safeTypeCompare.h.

◆ TfSafeTypeCompare()

bool TfSafeTypeCompare ( const std::type_info &  t1,
const std::type_info &  t2 
)
inline

Safely compare std::type_info structures.

Returns true if t1 and t2 denote the same type.

Definition at line 23 of file safeTypeCompare.h.