#include #include #include using namespace std ; // A regular function to be used with for_each void print_element(int n) { cout << n << " "; } int main() { vector numbers = {1, 2, 3, 4, 5}; // Using for_each with a function pointer for_each( numbers.begin(), numbers.end(), print_element ); cout << endl; return 0; }