Quote Originally Posted by D_Drmmr View Post
I think this mostly relates to the sort function. If you use a linked list you can sort the items without moving/swapping the data.
I already thought about the sort feature a bit but omitted that from post #7 for brevity. I considered implementing the sort by using an std::vector<int> to map from the item indices as seen by the client code to the actual indices of the items in the pool array.

My primary concern about the semantics of Remove() and operator[]() was whether the exposed item indices were supposed to remain constant (like the item addresses), which would imply that removing items (except the last one) leads to invalid indices within the range fom 0 to Count() - 1 for which operator[]() probably should return nullptr or throw an exception. (And by the way that would make the semantics of Count() rather abstract.)

However, and that was something I failed to consider before reading your post, once sorting gets introduced, constant item indices can't be maintained anymore anyway, rendering the "invalid indices" approach pretty senseless. So, properly anticipating the effect of sorting, that approach obviously is not reasonable anyway.