3 ms·
The reason I would argue this isn't call-by-reference is because of the additional syntax needed from the caller side. Similarly with C you can do swap(&a, &b).
by Jach 14y ago
The reason I would argue this isn't call-by-reference is because of the additional syntax needed from the caller side. Similarly with C you can do swap(&a, &b). In C++ you just need swap(a, b), it's up to the callee whether a and b are passed as references or not.
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]
- endianswap 14y agoI understand, now. You're taking an object and getting a reference to it, then passing the _value_ of that reference into the function you're calling, so it's still call-by-value where the value happens to have a semantic meaning as a reference to an object.