Unwrap variadic template into vararg of pointers of the same types
ryuukk_
ryuukk.dev at gmail.com
Fri Jul 8 12:20:13 UTC 2022
I'm not sure how to phrase it so it'll try with code
I have this piece of code that i would like to improve, right now
i have to create bunch of duplicates
```D
void view_it(A, B)(void function(entity_t, A*, B*) cb)
{
foreach(it, e; view!(Includes!(A, B)))
{
auto a = it.get!(A)(e);
auto b = it.get!(B)(e);
cb(e, a, b);
}
}
```
The problem when i try to introduce variadic template, is i can't
seem to understand how to unwrap the parameter as pointer type T
-> T*
```D
struct Includes(Args...) { alias args = Args; }
void view_it(Includes)(void function(entity_t, Includes.args* )
cb)
{
// do stuff
}
```
I get the following:
```Error: cannot have pointer to `(EEntityRemoved)```
Anyone got an idea?
Thanks!
More information about the Digitalmars-d-learn
mailing list