Function<bool(int)> Binary Search problem

The code below is provided in the guide.
Can someone please provide an explanation for the significance of function<bool(int)> f in last_true function

#include <bits/stdc++.h>
using namespace std;

int last_true(int lo, int hi, function<bool(int)> f) {
	lo--;
	while (lo < hi) {
		int mid = lo + (hi - lo + 1) / 2;
		if (f(mid)) {
			lo = mid;
		} else {
			hi = mid - 1;
		}
	}
	return lo;
}

int main() {
	int size;
	int max_ops;
	cin >> size >> max_ops;
	vector<int> arr(size);
	for (int &i : arr) { cin >> i; }

	sort(arr.begin(), arr.end());
	// Use 2e9 instead of INT32_MAX to avoid overflow
	cout << last_true(1, 2e9, [&](int x) {
		// Returns true if the median can be raised to x
		long long ops_needed = 0;
		for (int i = (size - 1) / 2; i < size; i++) {
			ops_needed += max(0, x - arr[i]);
		}
		return ops_needed <= max_ops;
	}) << endl;
}

When doing a binary search, each time you want to cut the search range in half, you will look at the middle element (in this case it is mid), and then do some “test” on it to see whether you should choose the first half or the second half.

In this case, the code is asking the test function as a parameter. Essentially, if you call the last_true function, the third parameter is the test function to use during the binary search, where it takes in an integer parameter mid, and returns a boolean for whether it should take the right half or not.

You can see the binary search call the test function f on line 8.