Kayomn wrote:

On Monday, 26 February 2018 at 21:04:51 UTC, TheFlyingFiddle wrote:
On Monday, 26 February 2018 at 20:50:35 UTC, Kayomn wrote:
[...]

Don't think you can alias member variables directly.

You could do this though:

struct Player {
    Entity entity;

    ref auto pos() inout { return entity.position; }
}

Which will give you most of what you want. Although if you want to take the address of pos you have to use

auto addr = &player.pos();

Damn, was hoping to keep my structs as plain old data-structures. Thanks for the info, guess I won't be doing this then.

write `pos` as free function then, and use UFCS. there is no real difference. ;-)

Reply via email to