C++ - how to apply separate filter

yes that’s the reason i ask for loop specifically.