Parameter pack expansion
Adam D. Ruppe
destructionator at gmail.com
Thu May 30 20:34:18 UTC 2019
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 yields
the members. Try this:
struct Foo {int a; string b; }
void test(int, string) {}
Foo foo;
test(foo.tupleof); // works!
> Basicaly, how do I preform tuple transformations
import std.meta;
then staticMap is like what your myMap thing was.
http://dpldocs.info/experimental-docs/std.meta.staticMap.html
More information about the Digitalmars-d-learn
mailing list