Persistent list
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Mon Nov 16 13:25:51 PST 2015
On 11/16/2015 10:18 PM, Jonathan M Davis wrote:
> I don't know of any way to templatize a member function on the type of
> the this pointer/reference, but maybe there's a template feature with
> which I'm not familiar enough.
Indeed there is.
class C{
void foo(this T)(){ pragma(msg, T); }
}
class D: C{}
void main(){
auto c=new const(C)();
c.foo();
auto d=new immutable(D)();
d.foo();
}
> But even if there _is_ such a feature, it won't work for virtual functions.
Yup.
More information about the Digitalmars-d
mailing list