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 the one explaining the solution on any other way beside the one with parsing the string containing the condition, or an answer that clarifies that this way of passing conditions is impossible.
Thanks in advance