How do UnrealScript iterators work in C++?

UnrealScript iterators have a straightfoward usage:

local aClassName aVariable;
 
foreach IteratorFunction(class'aClassName', aVariable, other parameters)
{
    // execute something here
}

However, in C++, iterator functions look different. For example, DynamicActors takes on the form

void AActor::DynamicActors ( class UClass* BaseClass, class UClass* InterfaceClass, class AActor** Actor )

This doesn’t return anything, and only modifies the value of Actor, so I have no idea how to use in in C++ to iterate over all dynamic actors that match given criteria. How would you write the foreach example from UnrealScript in C++?