I'm getting an unhelpful linker error, what've I got wrong?

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 28 06:02:04 PDT 2015


On Wednesday, 28 October 2015 at 12:06:14 UTC, Kagamin wrote:
> On Wednesday, 28 October 2015 at 11:48:27 UTC, pineapple wrote:
>> There's also a writebuffer method in the interface with this 
>> signature, though:
>>
>>     streamint writebuffer(T)(in T* buffer, in streamint count);
>
> Interface can't have templated virtual instance methods.

What might be my options for restructuring the code to avoid 
this, ideally without sacrificing functionality? I imagine I must 
be able to use a void pointer instead? But that's just ugly.

Maybe I could do something like this?

     streamint writebuffer(in void* buffer, in streamint count);
     final streamint writebuffer(T){in T* buffer, in streamint 
count){
         return this.writebuffer(cast(void*) buffer, 
sizeof(*buffer) * count);
     }


More information about the Digitalmars-d-learn mailing list