How do I pass the value instead of the reference of an array?

I think you can use this to copy the value instead of the reference: var b = a.slice(0); EDIT As the comments have mentioned and it’s also mentioned here: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/slice slice does not alter the original array, but returns a new “one level deep” copy that contains copies of the elements sliced from the original … Read more

Objective-C: Instance Variable in Category

A category can not declare additional instance variables but since OS X 10.6 and iOS 3.1 you can work around this with associative references. You can use associative references to simulate the addition of object instance variables to an existing class. Using associative references, you can add storage to an object without modifying the class … Read more

How to write an object to file in C++

You can override operator>> and operator<< to read/write to stream. Example Entry struct with some values: struct Entry2 { string original; string currency; Entry2() {} Entry2(string& in); Entry2(string& original, string& currency) : original(original), currency(currency) {} }; istream& operator>>(istream& is, Entry2& en); ostream& operator<<(ostream& os, const Entry2& en); Implementation: using namespace std; istream& operator>>(istream& is, Entry2& … Read more