I have main function which calls to download manager function. Inside of that function, I want to be able to use the pathUrl
inside the onFileTaskSuccess
function. How can i pass it in ?
std::string MyClass::DownloadFromUrl()
{
std::string pathUrl ="";
//Then i have downloader which looks like this:
this->m_downloader->onFileTaskSuccess = [this](const network::DownloadTask& task)
{
//i want to use pathUrl here .. how can i pass it to here ?
pathUrl = someValueFromTheApp;
}
return pathUrl;
}
EDIT:
My main goal is to return value from the main function i fixed the question
which is calculated in the inner lambda function.
i also tried :
this by reference:
this->m_downloader->onFileTaskSuccess = [this,&pathUrl,&someValueFromTheApp](const network::DownloadTask& task)
{
//i want to use pathUrl here .. how can i pass it to here ?
pathUrl = someValueFromTheApp;
}
but im getting this error:
error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const std::string' (or there is no acceptable conversion)