How to mixin each element of tuple

Timon Gehr timon.gehr at
Tue Dec 20 10:25:31 PST 2011

On 12/20/2011 07:13 PM, bearophile wrote:
> Michal Minich:
>> struct Group (Items ...)
>> {
>>      // how to do this? ... no static foreach :(
>>      static foreach (I; Items)
> In D if you use foreach on a typeTuple you get a static foreach.
> Bye,
> bearophile

Yes, but foreach cannot be used in declaration scope. I think having 
static foreach would greatly benefit the language. I regularly run into 
cases where I have to use one of the two inferior solutions when static 
foreach would be just the right tool for the job.

More information about the Digitalmars-d-learn mailing list