Mixin virtual functions -- overloads

Jarrett Billingsley jarrett.billingsley at gmail.com
Tue Feb 24 21:02:09 PST 2009


On Tue, Feb 24, 2009 at 11:39 PM, Tim M <a at b.com> wrote:
> On Wed, 25 Feb 2009 06:31:37 +1300, Justin <mrjnewt at gmail.com> wrote:

> You are probably using alias and/or mixin incorrectly. It would be easier
> with full source but as a guess are you trying to do something like this:

What he's doing is right, ostensibly; template mixins have never
cooperated with overloading.

> module main;
>
>
> class TypeThing(T)
> {
>      T data;
>      this()
>      {
>            //
>      }
>      void SetValue(T data)
>      {
>            this.data = data;
>      }
> }
>
> class boolThing : TypeThing!(bool)
> {
>      this()
>      {
>            //
>      }
> }
>
> void Register(char[] t)()
> {
>      mixin("class "~t~"Thing : TypeThing!("~t~")
>            {
>                  this()
>                  {
>                        //
>                  }
>            }");
> }
>
> void main()
> {
>      Register!("bool");
>      Register!("char");
> }

I.. really am not sure what you're trying to do there?  But your idea
of using string mixins instead of template mixins might be useful
here.  If only we didn't have to resort to string mixins at every turn
:P



More information about the Digitalmars-d mailing list