about const ref

Ferhat Kurtulmuş aferust at gmail.com
Tue Feb 11 07:51:04 UTC 2020


I need to be sure about "const ref". Based on the following 
function, does it mean:

Type can be string or an integral type.

(a) k1 is not copied on function calls
(b) k1 cannot be modified inside function

Please correct me if I am wrong. Can storage class "in" be used 
to satisfy (a) and (b)?


void doIt(const ref Type k1){
     ....
}

Type k = ...;

doit(k);


More information about the Digitalmars-d-learn mailing list