Strange “->* []” expression in C++ source code of cpp.react library

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)