YesOrNo: useful idiom helper or wanking?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Apr 11 12:58:10 PDT 2011
On 4/11/11 1:29 PM, Andrej Mitrovic wrote:
> On 4/11/11, KennyTM~<kennytm at gmail.com> wrote:
>> The idea, IIUC, is to avoid documenting that extra enum type. So, for
>> example,
>>
>> TRange topNCopy(alias less = "a< b", SRange, TRange)
>> (SRange source, TRange target,
>> YesOrNo!"SortOutput" sorted = false);
>>
>> and then we can call it as
>>
>> topNCopy([1,3,5,2,4], result, SortOutput.yes);
>
> But how do you make `SortOutput` known at the calling site?
I was hasty. I can't see a way for a mixin to introduce at the same time
SortOutput and itself in scope.
Andrei
More information about the Digitalmars-d
mailing list