const debacle

e-t172 e-t172 at akegroup.org
Sat Mar 22 05:09:45 PDT 2008


Janice Caron a écrit :
> On 22/03/2008, e-t172 <e-t172 at akegroup.org> wrote:
>>  A better
>>  idea would be to include a new "feature" in D 2.0, i.e. "compiled
>>  templates", with a new syntax like this :
>>
>>  T[] trim(T # [char,dchar,wchar]) (T[] source)
> 
> I believe you can already do that - albeit with a different syntax.
> 
>     T[] trim(T) (T[] source)
>     {
>         /*...*/
>     }
> 
>     private
>     {
>         alias trim!(char) dummy1;
>         alias trim!(wchar) dummy2;
>         alias trim!(dchar) dummy3;
>     }
> 
> I think those aliases will force an instantiation.

As a matter of fact, it does, I just tried it. I learned something today :)

Now library developers just have to begin using this kind of aliases for 
templates which get only used with a few, known types, like in 
tango.text.Util.



More information about the Digitalmars-d mailing list