Hi, I have a hw question which confuses me on what i have to do. The question is below:
- The idea is to design a generic function called Modify_If that will take an input x (passed by reference), and two functors f1 and f2. The function Modify_If will use functor f1 to determine whether x obeys a certain condition. If it does, Modify_if will change the value of x, by applying functor f2 to it.
The prototype for Modify_If is as follows:
template <class C, class Tester, class Transform>
void Modify_If(C & a, Tester f, Transform g)
I have to write the Modify_If function but I have no idea where to start so if anyone can help me out I would appreciate it.