|
template<typename Target , typename Source > |
Target | polymorphic_downcast (Source *const x) |
| Check the validity of a downcast.
|
|
template<typename Target , typename Source > |
Target | polymorphic_downcast (Source &x) |
| Check the validity of a downcast.
|
|
template<typename Target , typename Source > |
Target | polymorphic_downcast (Source *const x) |
| Check the validity of a downcast.
|
|
template<typename Target , typename Source > |
Target | polymorphic_downcast (Source &x) |
| Check the validity of a downcast.
|
|
Encapsulate solution for Exercise 2-2.
template<typename Target , typename Source >
Target exercise_2_2::polymorphic_downcast |
( |
Source & |
x | ) |
|
|
inline |
Check the validity of a downcast.
This method asserts (in debug builds only) that the downcast was legal. This overload accepts a reference type.
- Template Parameters
-
Target | The resulting type of the cast. |
Source | The input datatype (wihtout reference). Do not specify this explicitly: it should be deduced by the compiler. |
- Parameters
-
[in] | x | An input reference type. |
- Returns
- A dynamically casted instance from the source type.
Definition at line 75 of file exercise-2-2.hpp.
template<typename Target , typename Source >
Target exercise_2_2::polymorphic_downcast |
( |
Source *const |
x | ) |
|
|
inline |
Check the validity of a downcast.
This method asserts (in debug builds only) that the downcast was legal. This overload accepts a pointer type.
- Template Parameters
-
Target | The resulting type of the cast. |
Source | The input datatype (wihtout pointer). Do not specify this explicitly: it should be deduced by the compiler. |
- Parameters
-
[in] | x | An input pointer type. |
- Returns
- A dynamically casted instance from the source type.
Definition at line 55 of file exercise-2-2.hpp.