how to have alias this with an unaccessible member?

Timothee Cour thelastmammoth at gmail.com
Fri May 17 16:13:00 PDT 2013


How to have alias this with an unaccessible member (x below).
Making the member private won't work as it'll disable all operations on
said member.

----
struct A(T){
  T x;
  //private T x would prevent alias this from doing anything useful
  alias x this;
}
void main(){
  auto a=A!int;
  a++;//should do a.x++;
  static assert(!__traits(compiles,a.x)); // I want this to hold

}
----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130517/34a05da6/attachment.html>


More information about the Digitalmars-d-learn mailing list