Walter is right about transitive readonly - here's the alternative
Sean Kelly
sean at f4.ca
Thu Sep 13 16:08:18 PDT 2007
Frits van Bommel wrote:
> Sean Kelly wrote:
>> Though the lack of a dot operator overload may complicate the syntax a
>> tad.
>
> Isn't that what 'alias this' would be for?
Hrm... so something like this?
struct SmartPtr( T ) {
T* val;
static if( is( T == class ) ||
is( T == struct ) )
alias val this;
void opAssign( T* v ) {
val = v;
}
}
struct S {
void foo() {}
}
SmartPtr!(S) p = new S;
p.foo();
Seems like it would work, huh :-) I hadn't really thought about 'alias
this' in this context.
Sean
More information about the Digitalmars-d
mailing list