volatile struct definition for peripheral control registers

Josh Holtrop jholtrop at gmail.com
Mon Dec 2 20:27:23 UTC 2024


On Monday, 2 December 2024 at 19:30:06 UTC, Ali Çehreli wrote:
> On 12/2/24 11:10 AM, Josh Holtrop wrote:
>
> > This works but requires that ugly .get call rather than just
> accessing
> > it directly.
>
> 'alias this' may help:
>
>   https://dlang.org/spec/struct.html#alias-this
>
> All you need to do is to add the following line to the Volatile 
> template:
>
>   alias get this;
>
> Ali

If I use `alias this` I don't know how I can get `volatileLoad()` 
to be called.


More information about the Digitalmars-d-learn mailing list