std::experimental:: any_cast
From cppreference.net
<
cpp
|
experimental
|
any
|
template
<
class
ValueType
>
ValueType any_cast ( const any & operand ) ; |
(1) | (ライブラリ基盤 TS) |
|
template
<
class
ValueType
>
ValueType any_cast ( any & operand ) ; |
(2) | (ライブラリ基盤 TS) |
|
template
<
class
ValueType
>
ValueType any_cast ( any && operand ) ; |
(3) | (ライブラリ基盤 TS) |
|
template
<
class
ValueType
>
const ValueType * any_cast ( const any * operand ) noexcept ; |
(4) | (ライブラリ基盤 TS) |
|
template
<
class
ValueType
>
ValueType * any_cast ( any * operand ) noexcept ; |
(5) | (ライブラリ基盤 TS) |
含まれるオブジェクトへの型安全なアクセスを実行します。
(1-3)
の場合、
ValueType
が参照型ではなく、かつ
std::
is_copy_constructible
<
ValueType
>
::
value
が
false
である場合、プログラムは不適格となります。
パラメータ
| オペランド | - |
ターゲット
any
オブジェクト
|
戻り値
1)
*
any_cast
<
std::
add_const_t
<
std::
remove_reference_t
<
ValueType
>>>
(
&
operand
)
を返します。
2,3)
*
any_cast
<
std::
remove_reference_t
<
ValueType
>>
(
&
operand
)
を返します。
4,5)
もし
operand
がnullポインタでなく、かつ要求された
ValueType
の
typeid
が
operand
の内容の型と一致する場合、
operand
が保持する値へのポインタ、そうでなければnullポインタ。
例外
1-3)
内容物の
operand
の型と要求された
ValueType
の
typeid
が一致しない場合、
bad_any_cast
をスローする。