Virtual templated functions. Previously: Preserving const? -- A potential solution
Christopher Wright
dhasenan at gmail.com
Sun Mar 8 06:33:56 PDT 2009
Tim M wrote:
> On Mon, 09 Mar 2009 00:58:14 +1300, Michel Fortin
> <michel.fortin at michelf.com> wrote:
>
>>
>> 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.
>>
>
>
>
> I remember you blogging about a way of compiling base classes with new
> methods and not needing to recompile the sub classes, I will read up on
> those genrics in C# and java later. If that doesn't work out, what if
> the compiler could check for all sub class functions within the same
> module and allowing a sort of limited virtual template functions, so no
> work through external libraries. I would prefer limited virtual over no
> virtual.
People would constantly complain and file bug reports about the
limitations. It's all or nothing. Nothing is the superior choice here.
More information about the Digitalmars-d
mailing list