|
|
|
|
|
by erik_seaberg
671 days ago
|
|
foo is receiving a mutable reference and it can't modify the map without those changes leaking out permanently to the caller: https://go.dev/play/p/DXchC5Hq8o8. Passing maps by value would have prevented this by copying the contents. It's a quirk of C++ that reference args can't be replaced but pointer args can. |
|
And the fact that C++ references can be used for assignment is essentially their whole point, not "a quirk".