func unsafeBitCast <T, U>(T, to: U.Type) -> U
An instance to cast to type T
.
T
にキャストすることになるインスタンス。
Availability
Technology
func unsafeDowncast<T>(_ x: AnyObject
, to type: T.Type) -> T where T : AnyObject
x
An instance to cast to type T
.
T
にキャストすることになるインスタンス。
type
The type T
to which x
is cast.
型T
、それへとx
がキャストされます。
The instance x
, cast to type T
.
インスタンスx
、型T
にキャスト済み。
The instance passed as x
must be an instance of type T
.
x
として渡されるインスタンスは、型T
のインスタンスでなければなりません。
Use this function instead of unsafe
because this function is more restrictive and still performs a check in debug builds. In -O builds, no test is performed to ensure that x
actually has the dynamic type T
.
この関数をunsafe
の代わりに使ってください、なぜならこの関数はより制限的で依然としてデバッグビルドにおいて検査を実行するからです。-Oビルドにおいて、全くテストは実行されずx
が実際に動的型T
を持つことを保証されません。
Warning 警告
This function trades safety for performance. Use unsafe
only when you are confident that x is T
always evaluates to true
, and only after x as! T
has proven to be a performance problem.
この関数は性能と安全を交換します。unsafe
は、あなたがx is T
は常にtrue
に評価されることを確信している場合にのみ、そしてx as! T
が性能問題をもつと証明された後にのみ使ってください。
func unsafeBitCast <T, U>(T, to: U.Type) -> U