Limited member function templates?
Michel Fortin
michel.fortin at michelf.com
Sat Nov 10 07:22:32 PST 2007
On 2007-11-10 01:30:46 -0500, "Janice Caron" <caron800 at googlemail.com> said:
> class A
> {
> string s;
>
> int f(T)(T t) { s = toUTF8(t); } /* template member function */
>
> alias f!(string) fs; /* explicit instantiation */
> alias f!(wstring) fw; /* explicit instantiation */
> }
Why don't you try `mixin` instead of `alias`? Then I think you can even
override them in subclasses, meaning they're made virtual. They're
difficult to overload though, at least in D 1.x without overload sets
(haven't tried with D 2.0).
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list