OwnedArray deep copy

In my application at some point I need to create a deep copy of an OwnedArray. Now this may be a silly question but I have not found copy constructor and there’s only the move constructor which I guess is there so that you can for example efficiently return OwnedArray as a return value of a function. I can probably use OwnedArray::addCopiesOf() instead, but I just need to ensure I am not missing something of the philosophy as to why the copy constructor is missing. Until recently I successfully evaded C++11 which is probably the reason I even need to ask this question…


There’s no copy constructor because it’d be too easy to accidentally (mis)use it!

But yes, just using the addCopiesOf method will do the trick.

OK, thanks Jules, I can imagine the problems caused by accidental copying of the array… Thanks for the explanation.

1 Like