Why can't I get std::function<std::vector<T>::iterator> to bind to lambda returning that type?
<p>I don't understand why this isn't working. I have a function that returns the result of the <code>std::find</code> method. I read that it returns an iterator to object it finds. But when I try passing the lambda that returns that value it gives me a bunch of errors, why?</p>

<pre><code>void f(std::function&lt;std::vector&lt;int&gt;::iterator()&gt;) {}

int main()
{
    std::vector&lt;int&gt; v{0, 1, 2, 3};

    auto p = [=] (int n) {
        return std::find(v.begin(), v.end(), n);
    };

    f(p);
}
</code></pre>

<p>I get a lot of incomprehensible errors. I even did a type check here and it returned true:</p>

<pre><code>std::is_same&lt;std::vector&lt;int&gt;::iterator, decltype(std::find(v.begin(), v.end(), N))&gt;::value;
// -&gt; true
</code></pre>

<p>So why doesn't this work when I pass a function to <code>f</code> with <code>std::function</code> that returns this type?</p>
