Jeremie Pelletier wrote:
Isn't it possible to make 'const ref S' or 'in S' generate the same
machine code as 'in S*'? To me it would seem the semantics of the two
are the same, with 'const S*' being useful syntax for C compatibility
while 'in S' and 'const ref S' are both D syntax.

The thing about const is it only specifies a read only view of an object, it does *not* specify that the referenced object will not change. That is why pass by value cannot be "optimized" to be pass by reference.

Reply via email to