alias this - am I using it wrong?

Johann Lermer johann.lermer at elvin.eu
Wed Aug 25 13:13:58 UTC 2021


On Wednesday, 25 August 2021 at 12:23:06 UTC, Adam D Ruppe wrote:
...

Thanks - that explains in all.

On Wednesday, 25 August 2021 at 12:23:32 UTC, FeepingCreature 
wrote:

> class Alias_Class
> {
>     Test_Struct ts;
>     Test_Struct getter() { return ts; }
>     alias getter this;
> }

Good idea, that should solve my current problem. The reason for 
having an alias this was that I had a C data type 
(cairo_surface_t) that I transferred into a class and I'm using 
the alias so that I don't need to rewrite the whole application 
at once. Unfortunately I overlooked some code that resulted in a 
seg fault - and I was lost at understanding why.


More information about the Digitalmars-d-learn mailing list