It is more or less impossible. The Javascript evaluation strategy should always use a call by value, but in the case of objects (including arrays), the passed value is a reference to an object that is not copied or cloned. If you reassign the object itself to a function, the original will not be changed, but if you reassign one of the properties of the object, it will affect the original object.
So what are you trying to achieve? If it just passes complex data between C ++ and Javascript, you can use the JSON library to communicate. Send the JSON object to C ++ for processing and get a JSON object to replace the old one.
user2310967 Apr 23 '13 at 15:34 2013-04-23 15:34
source share