Are there build in functions to add new element to TArray and remove last?

Why not use std::deque which can remove the last (the oldest data) and also the just inserted data?

And yes, after remove, it is horribly inefficient to shift every single member by one. What some people do is to swap content of ‘to be deleted’ to the last one (yes here, last one mean the just inserted) and then delete this new last one. Voila…this way, no body ever get shifted anywhere. And these functionalities exist in C++ STL (this is where std::deque comes from)

1 Like