inout type constructor applied to this-reference
Jakob Ovrum
jakobovrum at gmail.com
Fri Jan 10 19:05:17 PST 2014
On Friday, 10 January 2014 at 11:03:58 UTC, Matthias Walter wrote:
> Since the documentation only talks about marking arguments
> inout, can I
> nevertheless rely on its behavior? Anyways, I think it is worth
> to be
> included in the docs.
The implicit this-reference parameter is just that - another
parameter. Any type constructor/qualifier can be applied to it,
as with other parameters. Yes, you can rely on the behaviour. Use
of `inout` on the this-reference is one of the most common uses
of `inout`, as warranted by the popularity of member functions.
It is technically part of the documentation[1], but I agree that
this use case should probably be included in the description of
`inout`.
[1] http://dlang.org/declaration#MemberFunctionAttributes
More information about the Digitalmars-d-learn
mailing list