Type erasure with AnySequence

“Although it hides implementation complexity, there’s a minor penalty to this extra indirection. For example, if you wrap an Array in AnySequence (or AnyCollection ), you’ll no longer be able to access the contiguous storage buffer of the array. This lack of access occurs because, once again, protocols generally make no assumptions about the memory layout of the concrete types that adopt them.” I cannot understand what access the contiguous storage buffer of the array means.

An array may be randomly access by the use of an index. Where as a sequence is done sequentially (current, then next) only.

2 Likes