What is the difference between these two lines
CArray<MyClass, MyClass> MyArray CArray<MyClass, const MyClass & > MyArray
MyClass is always copied to an array. But the first form copies it twice: the first time it is specified as a parameter of the Add or SetAt function, the second time internally. With the second form, you avoid the first copy.
In the first case, you need to have an Accessable instance constructor in MyClass , and MyClass will be passed by value (copied) in some CArray members (for example, in CArray::Add ).
MyClass
CArray
CArray::Add