GCC Middle and Back End API Reference
is-a.h File Reference
This graph shows which files directly or indirectly include this file:

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)
 

Function Documentation

◆ as_a()

template<typename T , typename U >
T as_a ( U * p)
inline
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().

◆ dyn_cast()

template<typename T , typename U >
T dyn_cast ( U * p)
inline
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().

◆ is_a()

template<typename T , typename U >
bool is_a ( U * p)
inline
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().

◆ safe_as_a()

template<typename T , typename U >
T safe_as_a ( U * p)
inline
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.

◆ safe_dyn_cast()

template<typename T , typename U >
T safe_dyn_cast ( U * p)
inline
Similar to dyn_cast, except that the pointer may be null.   

References ggc_alloc().

◆ safe_is_a()

template<typename T , typename U >
bool safe_is_a ( U * p)
inline
Similar to is_a<>, but where the pointer can be NULL, even if
is_a_helper<T> doesn't check for NULL.   

References is_a_helper< T >::test().