C++ lambdas, "error: expected expression"
<p>I'm trying to reproduce java's streams API in C++, and have made this program so far.</p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

template &lt;typename E&gt;
class stream {
    virtual void collect(void (*consumer) (E)) = 0;
    virtual bool anyMatch(bool (*predicate) (E)) {
        bool found = false;
        collect([&amp;found](E obj) -&gt; { if (predicate(obj)) {found = true} });
        return found;
    }
};

int main() {
    return 0;
}
</code></pre>

<p>But when I try to compile it with g++:</p>

<p><a href="https://i.stack.imgur.com/xmieU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xmieU.png" alt="enter image description here"></a></p>

<p>What am I doing wrong the lambda? It is supposed to provide a function (the consumer) which will test the given E with the predicate (a function), and if it yields true, set found to true.</p>