Template Question
    Bill Baxter 
    dnewsgroup at billbaxter.com
       
    Sun Apr 13 23:17:19 PDT 2008
    
    
  
Mike Parker wrote:
> I've not worked much with templates in any language beyond the basics. 
> Right now, I've got a problem that I've solved, but for which I'm 
> looking a different solution.
> 
> What I have is a templated interface like so:
> 
> interface Foo(T)
> {
>     void init(T);
>     void term();
>     void blah();
>     void bleh();
> }
> 
> Then I have a Templated manager class intended to work with differently 
> parameterized Foos:
> 
> class Manager(U)
> {
>     ...
> }
> 
> The issue is that I want to make sure that Manager is instantiated with 
> Foos without it knowing what the T in Foo is. This obviously doesn't work:
> 
> class Manager(U : Foo)
> {
> }
I think there is a variation of that which is supposed to work:
class Manager(U : Foo!(T), T)
{
}
I'm not sure if it does in practice or not, though.
--bb
    
    
More information about the Digitalmars-d-learn
mailing list