One of the people trying to help you, provided this comment at the end
And when you had "some problems with them when their capacity changes", did you understand what the "problems" were, and the underlying reasons for those "problems"? I suspect that a couple of keywords, for these "problems" were typed in Google, and something came back that says "use pointers". Well, C++ is not that easy. Using pointers has many important implications, such as the fact that you now have to keep track of them, and manage their memory. Instead, the next step would be to investigate, learn, and understand the reasons for those "problems", and what is the right fix for them.
So that commenter, together with several others prior to that, is suggesting that you should change your approach to the problem. It's unclear why you don't want to do that, other than when you added this comment...
...I'm tring to avoid using vectors of objects (rather than pointers to them) after I've had quite some problems with them when their capacity changes
What problems? You don't say, so the commenters don't know how to address that other than by giving general advice.
So you have what's called an XY problem. Unless we can determine what X is we can't really help because answering the question "how do I stop it hurting when I shoot myself in the foot", with "more anaesthetic" is generally rather less useful than finding out why you're doing it and suggesting something else entirely.
In the end because the question didn't seem to be broadly useful or going anywhere (in the eyes of the delete voters), they deleted it.