I'm trying to return a string from a function that does some processing.
I've tried returning it as an rvalue reference and also as an lvalue reference. didn't work :(.
processing function:
std::string processingFunction()
{
std::string str = "";
//processing...
strftime(&str[0], MAX_LENGTH, DATE_FORMAT, tm_STRUCT_ADRRESS);
return str;
}
use of the function:
std::string temp = processingFunction();
if(temp.empty())
{
//stuff
}
When debugging (in VS 2019), I can see the value of temp
in the Watch, but temp.empty()
always returns 1
. Even if I can see that the value is present.
here is a screenshot for tl;dr: m_bucket_function is the processing function