Is it possible to "Get All Actors of Class" from code

I’m pretty new to Unreal Engine and i’m trying to find a way to call this method from a c++ class, and not from blueprint (i’m not going to use them for this project), as explained here:
Is it possible?

I have found this:
i guess it’s the only way to do it. looks nice.

Hi Filoppi,

Look at this page
A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine ForumsObject%26_Actor_Iterators,_Optional_Class_Scope_For_Faster_Search

Hope it helps!