How to mixin each element of tuple
Michal Minich
michal.minich at gmail.com
Wed Dec 21 01:12:11 PST 2011
On 20. 12. 2011 16:20, Timon Gehr wrote:
> struct Item1(T){}
> struct Item2(T){}
>
> mixin template getItems(Items ...){
> static if(Items.length) {
> private alias Items[0] _item;
> mixin _item!int;
> mixin getItems!(Items[1..$]);
> }
> }
>
> struct Group(Items...)
> {
> mixin getItems!Items;
> }
>
> void main(){
> alias Group!(Item1, Item2) G;
> }
>
Thank you. Solution 1 worked well.
The need to introduce new symbol '_item' using alias because one cannot
mixin Items[0]!int directly seems to me as a bug. Do you happen to know
if it is already reported?
More information about the Digitalmars-d-learn
mailing list