www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Turning fixed sized array into tuple

reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
So I have a function:

```d
size_t awaitAny(T...)(T args) { ... }
```

And I have:
``d
Event*[4] events;
``

How do I pass all 4 of events to awaitAny as tuple of arguments?

--
Dmitry Olshansky
CEO   [Glow labs](https://glow-labs.pro)
https://olshansky.me/about/
May 04
parent reply Nick Treleaven <nick geany.org> writes:
On Saturday, 4 May 2024 at 16:58:00 UTC, Dmitry Olshansky wrote:
 So I have a function:

 ```d
 size_t awaitAny(T...)(T args) { ... }
 ```

 And I have:
 ``d
 Event*[4] events;
 ``

 How do I pass all 4 of events to awaitAny as tuple of arguments?
Use `awaitAny(events.tupleof)`? https://dlang.org/spec/arrays.html#array-properties
May 04
parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On Saturday, 4 May 2024 at 19:11:14 UTC, Nick Treleaven wrote:
 On Saturday, 4 May 2024 at 16:58:00 UTC, Dmitry Olshansky wrote:
 So I have a function:

 ```d
 size_t awaitAny(T...)(T args) { ... }
 ```

 And I have:
 ``d
 Event*[4] events;
 ``

 How do I pass all 4 of events to awaitAny as tuple of 
 arguments?
Use `awaitAny(events.tupleof)`? https://dlang.org/spec/arrays.html#array-properties
Thanks, totally missed it! — Dmitry Olshansky CEO [Glow labs](https://glow-labs.pro) https://olshansky.me
May 04