Right now we have Array, OwnedArray, ReferenceCountedArray. But they don’t share any code. And besides the required difference in features, some of them have useful features that the others don’t have. For example ReferenceCountedArray has no clearQuick(). There are other differences too, like the sorting.
There’s a bunch of duplicated code. We desperately need to refactor these classes to have some common stuff like the sorting, the ensure allocated, and what not. I think it could be done by having a GenericArray class that takes a Policy template parameter. Array, OwnedArray, and ReferenceCountedArray would provide a suitable Policy object and then they could share all the code.
Comprehensive list of JUCE array containers that need a generic shared implementation
If I forgot anything, please let me know!