dmd 1.070 and 2.055 release

Nick Sabalausky a at a.a
Thu Sep 8 12:06:00 PDT 2011


"Timon Gehr" <timon.gehr at gmx.ch> wrote in message 
news:j4b1lr$1s8c$1 at digitalmars.com...
> On 09/08/2011 06:52 PM, Andrej Mitrovic wrote:
>> On 9/8/11, dsimcha<dsimcha at yahoo.com>  wrote:
>>> Uh...what's wrong with this at the top of every file:
>>>
>>> alias toUTFz!(const(wchar)*) toUTF16z;
>>>
>>
>> Maybe this is wrong:
>>
>> Error: template instance toUTFz!(const(wchar)*) does not match any
>> template declaration
>
> Yes, I think it D should be enhanced so that it is possible to partially 
> apply a template using alias, that would make alias a lot more useful.
>

Yea. In the meantime, you can do it manually on the template-declaration 
side with a nested template:

template foo(A,B)
{
    // whatever
}
alias foo!(x) bar; // Fail!

-->

template foo(A)
{
    template foo(B)
    {
        // whatever
    }
}
alias foo!(x) bar; // Ok!

Kinda annoying, but it works.

> For now, this will do:
>
> auto toUTF16z(S)(S str){return toUTFz!(const(wchar)*)(str);}
>
>
> BTW, why does toUTFz!(const(wchar)*) not work with UFCS? Is that a bug?

UFCS is half-broken in D2. Unfortunate, as it's one of my favorite features.




More information about the Digitalmars-d-announce mailing list