How to pass function variable to c++ lambda function
<p>I have main function  which calls to download manager function. Inside of that function, I want to be able to use the <code>pathUrl</code> inside the <code>onFileTaskSuccess</code> function. How can i pass it in ?</p>

<pre><code>std::string  MyClass::DownloadFromUrl()
{
    std::string pathUrl ="";
    //Then i have downloader which looks like this:
    this-&gt;m_downloader-&gt;onFileTaskSuccess = [this](const network::DownloadTask&amp; task)
    {
        //i want to use pathUrl here .. how can i pass it to here ?
        pathUrl = someValueFromTheApp;
    }
return pathUrl;
}
</code></pre>

<p><strong>EDIT:</strong><br>
My main goal is to return value from the main function i fixed the question<br>
which is calculated in the inner lambda function.
i also tried :
this by reference:</p>

<pre><code>this-&gt;m_downloader-&gt;onFileTaskSuccess = [this,&amp;pathUrl,&amp;someValueFromTheApp](const network::DownloadTask&amp; task)
        {
            //i want to use pathUrl here .. how can i pass it to here ?
            pathUrl = someValueFromTheApp;
        }   
</code></pre>

<p>but im getting this error:</p>

<pre><code>error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const std::string' (or there is no acceptable conversion) 
</code></pre>