how to have alias this with an unaccessible member?
Simen Kjaeraas
simen.kjaras at gmail.com
Sun May 19 05:34:26 PDT 2013
On Sat, 18 May 2013 02:12:00 +0200, Timothee Cour
<thelastmammoth at gmail.com> wrote:
> so in what you suggest, the exact same problem remains with 'get' being
> exposed instead of 'x', so the situation didn't improve...
>
> looks like it's impossible to achieve this?
Well, there is also opDot:
struct A(T) {
private T x;
T opDot() {
return x;
}
}
void main(){
auto a = A!int;
a++; //should do a.x++;
static assert(!__traits(compiles, a.x)); // This now holds!
}
However, now A!int is not an int (you can't pass it to functions taking
int).
--
Simen
More information about the Digitalmars-d-learn
mailing list