F
flopbucket
Hi,
Is this legal?
std::string foo()
{
std::string xyz = "FOO";
return xyz;
}
void bar()
{
const std::string s = foo();
// ... use s now
}
Does that force the xyz std::string that was returned (copy
constructed I assume) to be bound the the const reference and stay
around? Or is it going ot of scope since the object itself is not
being stored someplace explicitly named?
Thanks
Is this legal?
std::string foo()
{
std::string xyz = "FOO";
return xyz;
}
void bar()
{
const std::string s = foo();
// ... use s now
}
Does that force the xyz std::string that was returned (copy
constructed I assume) to be bound the the const reference and stay
around? Or is it going ot of scope since the object itself is not
being stored someplace explicitly named?
Thanks