On Thursday, 30 May 2019 at 20:55:00 UTC, Q. Schroll wrote: If it would be implemented, you could place your parameter pack into a Tuple-like structure with an opDispatch that returns such a Tuple again, but the contents would be the member components "projection" to the member. It's
On Thursday, 30 May 2019 at 20:34:18 UTC, Adam D. Ruppe wrote: Foo foo; test(foo.tupleof); // works! This is really neat! I will definitely use this in the future. import std.meta; then staticMap is like what your myMap thing was.
On Thursday, 30 May 2019 at 20:20:47 UTC, Tomas wrote: I'm very new to D, coming from C++ I'm missing parameter pack expansion and fold expressions. I also miss the expansion operator and fold expressions. In D, there is no such thing, and simulating it in a general way has so much friction
On 30.05.19 22:20, Tomas wrote: Surely, there has to be a standard function which does exactly(probably better) the same thing as what `myMap` does. Nope.
On Thursday, 30 May 2019 at 20:20:47 UTC, Tomas wrote: How do I do something like this in D? D's built-in tuples expand automatically when they are used. Library tuples (from phobos std.typecons) have a `.expand` method you can use. Fun fact: all structs also have a `.tupleof` thing that
I'm very new to D, coming from C++ I'm missing parameter pack expansion and fold expressions. For example, I want to write a function `f(x, ..., x[n])` which accepts any number of objects and calls `g(x.member, ..., x[n].member)`. In C++, I would write this: template void f(X