# Use Sequence operations on an inline-array

**URL:** <https://forums.swift.org/t/use-sequence-operations-on-an-inline-array/89785>\
**Category:** Using Swift\
**Tags:** functions, inlinearray\
**Created:** [September 27, 2026, 10:29am UTC](https://forums.swift.org/t/use-sequence-operations-on-an-inline-array/89785 "2026-09-27T10:29:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CTMacUser](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ctmacuser/32/1802_2.png) [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Post date:** [September 27, 2026, 10:29am UTC](https://forums.swift.org/t/use-sequence-operations-on-an-inline-array/89785/1 "2026-09-27T10:29:56Z")

</div>

AIUI, `InlineArray` does not conform to `Sequence`. How can I use `Sequence` operations, like `contains` or `allStatisfy`? Do I have to jump through an `UnsafeBuffer` hoop?

---

<div class="post-metadata">

**Author:** ![Slava\_Pestov](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/slava_pestov/32/30204_2.png) [@Slava\_Pestov](https://forums.swift.org/u/Slava_Pestov)\
**Post date:** [September 27, 2026, 4:28pm UTC](https://forums.swift.org/t/use-sequence-operations-on-an-inline-array/89785/2 "2026-09-27T16:28:53Z")

</div>

The Sequence protocol assumes that the elements of the sequence are copyable, and that the backing storage for the sequence is copy-on-write.

You could deal with the first issue by making the Sequence conformance conditional, but the second is insurmountable. If InlineArray conformed to Sequence, calling makeIterator() on an InlineArray would have to make a copy of the entire array to put inside the iterator.

---

<div class="post-metadata">

**Author:** ![scanon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/scanon/32/2445_2.png) [@scanon](https://forums.swift.org/u/scanon)\
**Post date:** [September 27, 2026, 7:03pm UTC](https://forums.swift.org/t/use-sequence-operations-on-an-inline-array/89785/3 "2026-09-27T19:03:08Z")

</div>

`InlineArray` cannot conform to `Sequence`, for the reasons Slava gave, but it's `indices` property does, which gives you a handy workaround: [Compiler Explorer](https://godbolt.org/z/oMxWTTx5j)

However, you should be aware that the semantics of `InlineArray` make it somewhat easier than it might otherwise be to stumble into performance footguns when using generic sequence algorithms like this, so in some cases it will be preferable to just write a "normal loop" using indexed access.
