我希望了解C++中NRVO的局限性。对于NRVO和elide T val,是否会对具有初始命名声明和单个返回的函数进行优化,即使函数myFunc()具有抛出潜力?
T myFunc(bool toThrow) {
T val;
if (toThrow) {
throw std::exception();
}
// Do other things here.
return val;
}https://stackoverflow.com/questions/57121850
复制相似问题