alias to a property as an argument to a mixin template

monarch_dodra monarchdodra at gmail.com
Mon Sep 24 00:01:29 PDT 2012


On Sunday, 23 September 2012 at 21:44:20 UTC, comco wrote:
>> [SNIP]
>> Now we can implement our rotate in terms of reassign:
>>
>>    void rotate(node* u) {
>>        auto v = u.right;
>>        reassign(u.right, v.left, u);
>>    }
>> This works and is general enough, but notice the duplication 
>> of u.right. I don't like it - this may become an arbitrary 
>> large expression.
>>
>> [SNIP]
>>
>>    void rotate(node* u) {
>>        node* v;
>>        mixin ReassignMixin!(v, u.right, v.left, u);
>>        reassign();
>>    }
>>
>> See how the client code looks nicer when the template 
>> arguments are not wrapped as strings.

I just don't see neither the problem, nor how the proposed 
solution is any better.

All I see is a clean, closed and finished rotate at first, and 
then... something else...

Relate:
BR 8718 I just filed:
Template mixin + string mixin name collision
http://d.puremagic.com/issues/show_bug.cgi?id=8718


More information about the Digitalmars-d-learn mailing list