Passing condition as parameter
First of all to explain what I'm trying to do: void Foo(int &num, bool condition); Foo(x, x > 3); This code basically would evaluate the bool of the condition before calling the function and then pass pure true or false. I'm looking for a way to make it pass the condition itself, so I could do something like this: void Foo(int &num, bool condition) { while(!condition) { num = std::rand(); } } I know there could be a workaround by passing a string containing the condition and parsing the latter, and I'm working on it right now, but I find it rather inefficient way. The accepted answer will be