I am writing a program where the user can set option flags at the beginning.
My problem is that I want to call different versions of a function based on user flags, and I don't want to have to do if(flag)
every time I am picking which version to call because I would have to check the if()
statement on every line I process.
This is a school project so I'm trying to find the most efficient way of determining which function I want to call, and I read
if()` statements are expensive here.
So is there is there a way to essentially say at the beginning
if(flag)
// use this function the rest of the program
else
// use this other function for the rest of the program