Converting a POD struct to a class at compile-time ?
    H. S. Teoh via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Jul 16 11:12:56 PDT 2014
    
    
  
On Wed, Jul 16, 2014 at 06:07:32PM +0000, Adam D. Ruppe via Digitalmars-d-learn wrote:
> Not a direct answer, but the way I'd do this is to just use
> composition:
> 
> class Foo {
>    YourStruct _this;
>    alias _this this;
> }
> 
> 
> boom, it'd work pretty well just like that...
+1, simple answer to simple question, and `alias this` totally rawks.
:-)
T
-- 
Famous last words: I *think* this will work...
    
    
More information about the Digitalmars-d-learn
mailing list