Minor problems with templates and mixins

Tom S h3r3tic at remove.mat.uni.torun.pl
Tue May 23 07:04:45 PDT 2006


Oskar Linde wrote:
> I posted about this a while ago too. For this case, the following 
> workaround seems to work:
> 
> template foo_(T) {
>   T foo(int  a) { return T.init; }
>   T foo(char a) { return T.init; }
> }
> 
> template foo(T) {
>   alias foo_!(T).foo foo;
> }
> 
> void main() {
>   foo!(float)('a');
> }

That's one cute hack ;) Thanks ! Anyhow, it shouldn't be necessary to 
use them if we want D to be a clean language...


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d-pu s+: a-->----- C+++$>++++ UL P+ L+ E--- W++ N++ o? K? w++ !O 
!M V? PS- PE- Y PGP t 5 X? R tv-- b DI- D+ G e>+++ h>++ !r !y
------END GEEK CODE BLOCK------

Tomasz Stachowiak  /+ a.k.a. h3r3tic +/



More information about the Digitalmars-d mailing list