Reputation: 25366
I have the following code:
auto x_is_valid = [](const MyX &x) -> bool {
return x.source != MyXValue::ABC;
};
auto objects = var_.var_in_box(*a, b, c, x_is_valid);
I am wondering:
x_is_valid
computed?How do I read this properly?
Thanks!
Upvotes: 1
Views: 110
Reputation: 28278
A mathematical analogy might help. Imagine a function f(x) = x^2
.
How is
f
computed?
It's right there: for any x
, the formula for computing is f(x) = x^2
.
Where does it take its input parameter?
From the caller.
The "answers" above are pretty pointless, but if you understand them in a context of a function in a mathematical sense, they might be helpful.
Upvotes: 2
Reputation: 206697
If var_.var_in_box
, expects a bool
as the last argument, then the call
auto objects = var_.var_in_box(*a, b, c, x_is_valid);
should result in a compile error.
If the above line compiles without any error, then the last argument type of the above is a callable object, not a bool
. Presumably, the function uses the passed in callable object to make a function call. It's not possible to determine from the posted code how the callable is called in the implementation of var_in_box
member function of the class.
Upvotes: 0