inout after function

Adam D. Ruppe destructionator at gmail.com
Sat Nov 25 22:00:14 UTC 2017


On Saturday, 25 November 2017 at 21:51:41 UTC, Dave Jones wrote:
> What does the "inout" after front() do here...

Applies the `inout` modifier to the hidden `this` variable inside 
the function.

https://dlang.org/spec/function.html#inout-functions

It basically makes it const inside the function, but on the 
outside, it matches whatever the constness was of the object it 
is called on.


More information about the Digitalmars-d-learn mailing list