Which value types in Swift supports copy-on-write?

后端 未结 1 1858
甜味超标
甜味超标 2021-01-12 19:08

I read about copy-on-write implementation for Array in Swift here.

Arrays, like all variable-size collections in the standard library, use copy-on-wri

1条回答
  •  悲哀的现实
    2021-01-12 20:10

    Copy-on write is supported for String and all collection types - Array, Dictionary and Set.

    Besides that, compiler is free to optimize any struct access and effectively give you copy-on-write semantics, but it is not guaranteed.

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题