Feature request: OwnedArray::call



Apologies if this has been covered or I’m barking up the wrong tree, but would it be possible to implement an OwnedArray::call feature similar to ListenerList? To call all the objects within an OwnedArray, I either have to make a for loop, or have a separate ListenerList, and so would find this very usefull.

Thank you.


If you can use c+±11 then it’s a one liner:

OwnedArray<MyObject> hey;

std::for_each (hey.begin(), hey.end(), [] (MyObject* obj) { obj->foo(); });


Wow. Is that a lambda? They boggled me first time looking, maybe time to try again! Thank you.


If you don’t like lambdas you can also write this without a lambda (it’s even shorter then):

OwnedArray<MyObject> array;

for (auto obj : array) obj->foo();


Very nice, I think I’ve got some more advanced C++ to learn!