C++ Macro to D mixin template, delegates Please help

Regan Heath regan at netmail.co.nz
Fri Sep 21 03:25:22 PDT 2007


BLS wrote:
> Regan Heath schrieb:
>> BLS wrote:
>>> Regan Heath schrieb:
>>>> Henning Hasemann wrote:
>>
>> I don't understand.  What doesn't the code Henning posted do, that you 
>> need it to do??
>>
> 
> Probabely, because I am not genius... :-( I 'd better read it twice! 

Join the club ;)

> Just one question : It seems that you use template overloading, or do I 
> miss something. 

The mixin mixes in a function "newMsgProc" which should overload a base 
class function of the same signature (whether mixed in also or typed).

I think this works, but I am not 100% certain.  The docs do say:
"Templates cannot be used to add non-static members or functions to classes"

on the templates page, but I'm not sure if that applies to "template 
mixins" too, or what.

 > In other words : Can I use template overloading like
> function overloading ?

I think so, however you can't mix template function and function 
overloading, i.e.

class Foo
{
   void foo(T)(T arg)
   {
   }

   void foo(float arg)
   {
   }
}

But Walter plans to make this work I believe.

Regan


More information about the Digitalmars-d-learn mailing list