Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 25, 2011 How to Mixin a Type List? | ||||
---|---|---|---|---|
| ||||
Instead of mixing in type by type, is there a way to mixin a Type Tuple? Some foreach Type mixin; Otherwise, I guess recursive templated inheritance with a single mixin at each level should to the trick? Thanks, Nick |
January 25, 2011 Re: How to Mixin a Type List? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick | On Tue, Jan 25, 2011 at 12:33, Nick <nick@example.com> wrote:
> Instead of mixing in type by type, is there a way to mixin a Type Tuple? Some foreach Type mixin;
>
> Otherwise, I guess recursive templated inheritance with a single mixin at each level should to the trick?
Could you give an example of type mixin? I'm not sure I understand what you're trying to do.
Philippe
|
January 25, 2011 Re: How to Mixin a Type List? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick | Nick <nick@example.com> wrote: > Instead of mixing in type by type, is there a way to mixin a Type Tuple? Some foreach Type mixin; > > Otherwise, I guess recursive templated inheritance with a single mixin at each level should to the trick? That would be the way to do it, yes: template chainedMixin( alias head, tail... ) { mixin head; mixin chainedMixin!tail; } template chainedMixin( alias head ) { mixin head; } -- Simen |
February 19, 2011 Re: How to Mixin a Type List? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen kjaeraas | On 1/25/2011 11:33 PM, Simen kjaeraas wrote:
> Nick <nick@example.com> wrote:
>
>> Instead of mixing in type by type, is there a way to mixin a Type
>> Tuple? Some foreach Type mixin;
>>
>> Otherwise, I guess recursive templated inheritance with a single mixin
>> at each level should to the trick?
>
> That would be the way to do it, yes:
>
> template chainedMixin( alias head, tail... ) {
> mixin head;
> mixin chainedMixin!tail;
> }
>
> template chainedMixin( alias head ) {
> mixin head;
> }
>
Thanks! The problem is with mixing containing identical members. Then I need to disambiguate to address them. For that, I'd need to say something like
mixin head headIdentifier;
But I would need to differentiate somehow those identifiers... Any ideas?
Thanks!
|
Copyright © 1999-2021 by the D Language Foundation