Is calling this function creating a memory leak?
#include <iostream>
std::string somefunc()
{
std::string somestrng;
somestrng = "Fred";
return somestrng;
}
int main()
{
std::cout << "Hello World!\n";
std::string receiver = somefunc();
std::cout << "-->" << receiver.data() << "<--" << std::endl;
}
I've read about "value semantics" but I can't envision it.