The rttr_cast function behaves similarly to the standard C++
dynamic_cast. However, it has some advantages, it doesn't require RTTI support, it works across dynamic library boundaries and it performs faster. Run the
benchmark target to perform this test on your local machine.
The function rttr_cast allows the client to cast between class hierarchies up and down, cross casts between unrelated classes and even class hierarchies with virtual inheritance. The target type
T can be also in the middle of the hierarchy.
Cross casts are also possible:
- Because exception are not supported the target type
Tcan only be a pointer type.
- when it's necessary to perform down casts or cross casts with a given instance, then use