Type Qualifiers and Wild Cards
Walter Bright
newshound2 at digitalmars.com
Tue Nov 8 00:49:43 PST 2011
On 11/8/2011 12:44 AM, Don wrote:
> This compiles:
>
> inout(int *) foo(inout(int *) a)
> {
> inout x = a;
> return x;
> }
>
> and it doesn't compile if you replace 'inout x' with 'const x'.
>
inout can implicitly convert to const, but const cannot implicitly convert to
inout, hence the error on the return x;
But you're right, use inout in the body, and it is treated much like const.
More information about the Digitalmars-d
mailing list