Why do "const inout" and "const inout shared" exist?
ag0aep6g via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jul 2 02:34:12 PDT 2017
On 07/02/2017 10:55 AM, Walter Bright wrote:
> If it is declared as:
>
> inout(char)[] foo(bool condition, inout(char)[] chars);
>
> your specific case will work as expected. Perhaps you meant:
No, it doesn't. The function doesn't compile with that signature.
----
inout(char)[] foo(bool condition, inout(char)[] chars)
{
if (!condition)
return "condition failed!"; /* Error: cannot implicitly convert
expression "condition failed!" of type string to inout(char)[] */
return chars;
}
----
More information about the Digitalmars-d
mailing list