Cast()

SmartPtr::Cast() const method

Casts pointer to its type itself.

template<class Y,typename Check> std::enable_if_t<std::is_same<Y, T>::value, SmartPtr<Y>> System::SmartPtr<T>::Cast() const

Template parameters

ParameterDescription
YTarget type of pointed object.
CheckFlags to throw exception if no cast available.

Return Value

Pointer of changed type which is always in shared mode.

SmartPtr::Cast() const method

Casts pointer to base type using static_cast.

template<class Y,typename Check> std::enable_if_t<!std::is_same<Y, T>::value &&std::is_base_of<Y, T>::value, SmartPtr<Y>> System::SmartPtr<T>::Cast() const

Template parameters

ParameterDescription
YTarget type of pointed object.
CheckFlags to throw exception if no cast available.

Return Value

Pointer of changed type which is always in shared mode.

SmartPtr::Cast() const method

Casts pointer to derived type dynamic_cast.

template<class Y,typename Check> std::enable_if_t<Check::value &&!std::is_same<Y, T>::value &&!std::is_base_of<Y, T>::value, SmartPtr<Y>> System::SmartPtr<T>::Cast() const

Template parameters

ParameterDescription
YTarget type of pointed object.
CheckFlags to throw exception if no cast available.

Return Value

Pointer of changed type which is always in shared mode. Throws InvalidCastException if no conversion available.

SmartPtr::Cast() const method

Casts pointer to derived type dynamic_cast.

template<class Y,typename Check> std::enable_if_t<!Check::value &&!std::is_same<Y, T>::value &&!std::is_base_of<Y, T>::value, SmartPtr<Y>> System::SmartPtr<T>::Cast() const

Template parameters

ParameterDescription
YTarget type of pointed object.
CheckFlags to throw exception if no cast available.

Return Value

Pointer of changed type which is always in shared mode. Returns nullptr if no conversion available.

See Also