reflect on this function

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 20 15:24:02 PST 2015


On Fri, 20 Feb 2015 22:51:21 +0000, Vlad Levenfeld wrote:

> On Friday, 20 February 2015 at 22:44:35 UTC, ketmar wrote:
>> can you go with `relationImpl` and mixin/template that generates
>> `relation` with contract then? something like:
>>
>>   @reflexive @transitive bool relationImpl (T)(T a, T b) { ... }
>>   alias relation = buildWithContracts!relationImpl;
>>
>> then you can simply call `relationImpl` in your out section.
> 
> Yeah, this looks pretty good. As much as I hate the pimpl idiom,
> having a one-liner alias right next to the definition should minimize
> the eye-bleeding. Thanks!

and you can have an alias even before definition! ;-) this way it will 
not lost.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150220/d286aa80/attachment-0001.sig>


More information about the Digitalmars-d-learn mailing list