# Who benefits from the \`indirect\` keyword?

**URL:** <https://forums.swift.org/t/who-benefits-from-the-indirect-keyword/20167>\
**Category:** Using Swift\
**Created:** [February 5, 2019, 10:34am UTC](https://forums.swift.org/t/who-benefits-from-the-indirect-keyword/20167 "2019-02-05T10:34:16Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![LucianoPAlmeida](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/lucianopalmeida/32/2134_2.png) [@LucianoPAlmeida](https://forums.swift.org/u/LucianoPAlmeida)\
**Post date:** [June 7, 2020, 7:35pm UTC](https://forums.swift.org/t/who-benefits-from-the-indirect-keyword/20167/12 "2020-06-07T19:35:55Z")

</div>

> [@Lantua](#):
>
> The layout would be 1 Int + 1 Array. IIRC `Array` has its own heap-allocated storage under the hood (with a few metadata), so `Recursive` ends up having finite size (with the `next` entry floating somewhere else in the heap memory).

That's kinda what I was expecting. Thank you @Lantua :)

> [@Lantua](#):
>
> Makes me thing we may want to have `indirect` inside `struct` , which would most definitely do different from enum, but achieve the same effect on memory footprint.

Do you mean something like

```swift
struct Recursive {
  var value: Int
  indirect var next: Recursive?
}

```

?

I think this would make sense as you said.

---

_[View the full topic](https://forums.swift.org/t/who-benefits-from-the-indirect-keyword/20167)._
