Efficiently retrieve all objects with certain tag

Hey so for the game I’m making I wanted to be able to activate/deactivate certain objects upon button press assuming they have a certain tag. I’ve had a look through some answers but the consensus seems to be that tags aren’t greatly efficient at the moment and I didn’t end up finding any solutions. Therefore I was wondering whether anyone could either providing an alternative approach to this or an example of how to retrieve objects with a certain tag in C++. All help appreciated, thanks!

Add your objects to an array during creation, and reference this array when you need access them efficiently.