System::SmartPtr::Cast メソッド

SmartPtr::Cast() const method

ポインタをその型自身にキャストします。

template<class Y,typename Check> std::enable_if_t<std::is_same<Y, T>::value, SmartPtr<Y>> System::SmartPtr<T>::Cast() const
パラメーター説明
Y指し示すオブジェクトのターゲット型。
Checkキャストが利用できない場合に例外をスローするフラグ。

ReturnValue

常に共有モードである、型が変更されたポインタ。

参照

SmartPtr::Cast() const method

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
パラメーター説明
Y指し示すオブジェクトのターゲット型。
Checkキャストが利用できない場合に例外をスローするフラグ。

ReturnValue

常に共有モードである、型が変更されたポインタ。

参照

SmartPtr::Cast() const method

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
パラメーター説明
Y指し示すオブジェクトのターゲット型。
Checkキャストが利用できない場合に例外をスローするフラグ。

ReturnValue

常に共有モードである、型が変更されたポインタ。変換が利用できない場合は InvalidCastException をスローします。

参照

SmartPtr::Cast() const method

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
パラメーター説明
Y指し示すオブジェクトのターゲット型。
Checkキャストが利用できない場合に例外をスローするフラグ。

ReturnValue

常に共有モードである、型が変更されたポインタ。変換が利用できない場合は nullptr を返します。

参照