Forwarding or merging 'this' into a child class to aid chaining methods?
    Ali Çehreli 
    acehreli at yahoo.com
       
    Thu Mar  6 11:30:25 PST 2014
    
    
  
On 03/06/2014 11:16 AM, anonymous wrote:
 >      public auto foo(this T)()
 >      {
 >          return cast(T) this;
 >      }
 >
 > http://dlang.org/template.html#TemplateThisParameter
Sweet! :) Unfortunately, it has a somewhat obfuscated definition: 
"TemplateThisParameters are used in member function templates to pick up 
the type of the this reference."
"type of the this reference" does not explain that it is about the type 
of the most derived object.
Ali
    
    
More information about the Digitalmars-d-learn
mailing list