Mixin virtual functions -- overloads
Tim M
a at b.com
Tue Feb 24 21:23:55 PST 2009
On Wed, 25 Feb 2009 18:02:09 +1300, Jarrett Billingsley
<jarrett.billingsley at gmail.com> wrote:
> 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
I dont know what I was trying to do either :). Infact the classes are
defined in the wrong scope. Can you show what the actuall overload
template mixin problem is?
More information about the Digitalmars-d
mailing list