[Issue 4856] opDispatch does not work with specified template parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 14 17:45:19 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4856


Guillaume Benny <guillaume.benny at sympatico.ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #1 from Guillaume Benny <guillaume.benny at sympatico.ca> 2010-09-14 17:44:47 PDT ---
Simen Kjaeraas found a solution:

http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=117353

===
The correct way to do what you want is this: 

module foo; 

import std.stdio; 

struct test { 
     template opDispatch( string name ) { 
         void opDispatch( string other )( ) { 
             writeln( name, ", ", other ); 
         } 
     } 
} 

void main( ) { 
     test t; 
     t.foo!( "Hey!" )( ); 
} 
===

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list