Jamba  3.0.2
pongasoft::Utils::Cast< U > Class Template Reference

#include <Metaprogramming.h>

Static Public Member Functions

template<typename T >
static U dynamic (T *iPtr, typename std::enable_if<!std::is_polymorphic< T >::value >::type *=nullptr)
 
template<typename T >
static U dynamic (T *iPtr, typename std::enable_if< std::is_polymorphic< T >::value >::type *=nullptr)
 

Detailed Description

template<typename U>
class pongasoft::Utils::Cast< U >

dynamic_cast<U *>(x) does not compile if x is not polymorphic. This class can be used instead and it will, at compilation time, do the "right" thing. The usage is the following: Cast<U*>::dynamic(x). Note that, unlike dynamic_cast, it does not handle & because the code needs to not fail when x is not polymorphic.

Member Function Documentation

◆ dynamic() [1/2]

template<typename U >
template<typename T >
static U pongasoft::Utils::Cast< U >::dynamic ( T *  iPtr,
typename std::enable_if<!std::is_polymorphic< T >::value >::type *  = nullptr 
)
inlinestatic

◆ dynamic() [2/2]

template<typename U >
template<typename T >
static U pongasoft::Utils::Cast< U >::dynamic ( T *  iPtr,
typename std::enable_if< std::is_polymorphic< T >::value >::type *  = nullptr 
)
inlinestatic

The documentation for this class was generated from the following file: