Virtual templated functions. Previously: Preserving const? -- A potential solution
Michel Fortin
michel.fortin at michelf.com
Sun Mar 8 04:58:14 PDT 2009
On 2009-03-08 06:38:13 -0400, "Tim M" <a at b.com> said:
>> Avoiding dynamic instantiation, you HAVE to know what template instances
>> are going to be needed at compile time. You can't wave your hands and
>> make it go away.
>
> I'm not saying guess the template instance. I'm saying use the same
> exact types for instance in class A to instantiate template in class B
> where the signature is exactly the same. There is absolutely no guess
> work as everything is KNOWN.
If you introduce a way to limit templates to what generics can do in
Java and C#, you can have virtual template functions. Java and C#
generics can do only do a subset of what templates can do, but this
ensure there's only one compiled code instanciation. So perhaps
non-final non-static member template functions could be constrained to
generic-like operations and thus could become virtual.
I remembrer myself proposing this a few months ago, but it didn't caught on.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list