c++ - Does returning by const value affect return value optimization? -
this question has answer here:
consider function
const std::string f() { return "hello"; }
and call
std::string x = f();
regardless of whether value return types should const or not, fact return value const, prevent compiler performing return value optimization?
my understanding of rvo returned object constructed directly variable outside function. however, if return type const t
, isn't same t
, rvo prevented?
Comments
Post a Comment