Copy Array of OwnedArray Pointers


Can anyone suggest a good way to get read-only access to a JUCE OwnedArray? That is, I would like an effective way to access/change the data pointed to but not allow changes to the OwnedArray itself.  A copy of the pointers seems like a starting place.  It might look something like this:

OwnedArrray<class> things;

Array<class*> getThingsCopy();

Array<class*> temp = getThingsCopy();

// Do stuff

Perhaps, it would be better to return iterators, rather than a copy of all the pointers, each time?


Why not just return a const reference to your OwnedArray? That's got zero overhead and the caller would be unable to alter it..

Thanks! That sounds like the best way of doing it.