2 ms·
> Sure, but passing by value isn't always realistic. If you have a hashtable with a million entries, you can't copy it just to update a value. What else are yo
by astrange 6y ago
> Sure, but passing by value isn't always realistic. If you have a hashtable with a million entries, you can't copy it just to update a value.
What else are you going to do? If you want to insert a value but also have access to the hashtable without the change, then you need to copy it. (Or use a data structure with history tracking, like RCU or finger trees.)
If you don't need the old value, then you can optimize out the copy - this isn't too hard.