How to require operator overloading in interface

JS js.mdnq at gmail.com
Sat Jul 20 03:13:49 PDT 2013


On Saturday, 20 July 2013 at 01:37:13 UTC, Jesse Phillips wrote:
> The relevant blog post:
>
> http://3d.benjamin-thaut.de/?p=94
>
> What you should understand is template functions are not/can 
> not be virtual. They do not exist until they are instantiated. 
> Thus you can not require that they be overloaded.


And this is a compiler limitation? After all, templated functions 
are ultimately just normal functions... In my case the template 
parameter is explicitly known and the overloadable operations 
being templated isn't my fault.

I guess I can redirect each templated function to a non-templated 
version using the method in benjamin's page but this seems like 
it defeats exactly what templates are for...



More information about the Digitalmars-d-learn mailing list