Propagating constness through function results
    Steven Schveighoffer 
    schveiguy at yahoo.com
       
    Mon Sep 18 01:20:26 UTC 2017
    
    
  
On 9/17/17 5:37 PM, David Zhang wrote:
> Nevermind! I rediscovered the `inout`attribute.
Correct, inout applied to the function is actually applying to the 
'this' parameter. Same as const or immutable functions as well.
> 
> Though if I may say so, I have no idea how `inout` is supposed to 
> indicate "whatever the constness of a".
> 
What inout does is look at the mutability of the parameter and transfer 
it to the mutability of the return type.
-Steve
    
    
More information about the Digitalmars-d-learn
mailing list