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);
    }

Reply via email to