On 01/22/2016 01:57 PM, maik klein wrote:

It seems that D doesn't have a way to express C++'s fold
expression/template expansions.


For example in C++ I could write

std::make_tuple(std::ref(ts)...);

and it would expand like

std::make_tuple(std::ref(t1), std::ref(t2), ... , std::ref(tn));
...
For example I need to be able to expand TupleRef like this

f(someTupleRef.expand);
f(t[0].get(), t[1].get(), ... , t[n].get());

Custom expansions can be built with string mixins.

mixin(`f(`~iota(t.length).map!(i=>text(`t[`,i,`].get()`)).join(",")~`);`);

Reply via email to