Here is a C++ snippet that I found in the documentation of the cpp.react library:
auto in = D::MakeVar(0);
auto op1 = in ->* [] (int in)
{
int result = in
The only example on the linked page where I see ->*
is this:
auto in = D::MakeVar(0);
auto op1 = in ->* [] (int in)
{
int result = in /* Costly operation #1 */;
return result;
};
auto op2 = in ->* [] (int in)
{
int result = in /* Costly operation #2 */;
return result;
};
Here's my guess - whatever type is returned by D::MakeVar()
overloads the pointer-to-member operator ->*
, and the second argument for that overloaded operator is a function object, i.e. the lambda expression.
As for this example:
auto volume = (width,height,depth) ->* [] (int w, int h, int d) {
return w * h * d;
};
I'm guessing whatever types width
, height
& depth
are, overload the comma operator, and the result yields the same type as what MakeVar
yields, or another type that overloads ->*
. The rest is the same as the first example.