GCC Middle and Back End API Reference
|
Go to the source code of this file.
Data Structures | |
struct | reinterpret_is_a_helper< T > |
struct | static_is_a_helper< T > |
struct | is_a_helper< T > |
struct | is_a_helper< const T * > |
Functions | |
template<typename T , typename U > | |
bool | is_a (U *p) |
template<typename T , typename U > | |
bool | safe_is_a (U *p) |
template<typename T , typename U > | |
T | as_a (U *p) |
template<typename T , typename U > | |
T | safe_as_a (U *p) |
template<typename T , typename U > | |
T | dyn_cast (U *p) |
template<typename T , typename U > | |
T | safe_dyn_cast (U *p) |
A generic conversion from a base type U to a derived type T. See the discussion above for when to use this function.
References reinterpret_is_a_helper< T >::cast(), gcc_checking_assert, and ggc_alloc().
A generic checked conversion from a base type U to a derived type T. See the discussion above for when to use this function.
References reinterpret_is_a_helper< T >::cast(), and ggc_alloc().
Note that we deliberately do not define the 'test' member template. Not doing so will result in a build-time error for type relationships that have not been defined, rather than a run-time error. See the discussion above for when to define this member.
The public interface.
A generic test for a type relationship. See the discussion above for when to use this function. The question answered is "Is type T a derived type of type U?".
References is_a_helper< T >::test().
Similar to as_a<>, but where the pointer can be NULL, even if is_a_helper<T> doesn't check for NULL.
References reinterpret_is_a_helper< T >::cast(), gcc_checking_assert, ggc_alloc(), and NULL.
Similar to dyn_cast, except that the pointer may be null.
References ggc_alloc().