System::SmartPtr::Cast method

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
ParameterDescription
YTarget type of pointed object.
CheckFlags to throw exception if no cast available.

ReturnValue

Pointer of changed type which is always in shared mode.

See Also

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
ParameterDescription
YTarget type of pointed object.
CheckFlags to throw exception if no cast available.

ReturnValue

Pointer of changed type which is always in shared mode.

See Also

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
ParameterDescription
YTarget type of pointed object.
CheckFlags to throw exception if no cast available.

ReturnValue

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

See Also

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
ParameterDescription
YTarget type of pointed object.
CheckFlags to throw exception if no cast available.

ReturnValue

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

See Also