Template Question
Mike Parker
aldacron71 at yahoo.com
Mon Apr 14 18:56:43 PDT 2008
Bill Baxter wrote:
> 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.
>
>
Unfortunately, it doesn't.
More information about the Digitalmars-d-learn
mailing list