gracicot to C++English · vor 3 JahrenThe move constructor that you have to declare, even though you don't want anyone to actually call it - The Old New Thingdevblogs.microsoft.comexternal-linkmessage-square7linkfedilinkarrow-up18arrow-down10cross-posted to: cpp@programming.devcpp@programming.dev
arrow-up18arrow-down1external-linkThe move constructor that you have to declare, even though you don't want anyone to actually call it - The Old New Thingdevblogs.microsoft.comgracicot to C++English · vor 3 Jahrenmessage-square7linkfedilinkcross-posted to: cpp@programming.devcpp@programming.dev
minus-squaregracicotOPlinkfedilinkEnglisharrow-up1·vor 3 JahrenI think compiler move return value by default, so even without NRVO you should never move a return value when it’s a local non reference variable.
minus-square🇨🇦 tunetardis@lemmy.calinkfedilinkEnglisharrow-up1·vor 3 JahrenWell the test3 example FTA gives a case where NRVO would not happen because of the conditional return value. Are you suggesting that you need not std::move even in this case?
minus-squaregracicotOPlinkfedilinkEnglisharrow-up1·vor 3 JahrenI would still say “no” since they are local objects and they are gonna be moved from implicitly anyway
I think compiler move return value by default, so even without NRVO you should never move a return value when it’s a local non reference variable.
Well the
test3example FTA gives a case where NRVO would not happen because of the conditional return value. Are you suggesting that you need notstd::moveeven in this case?I would still say “no” since they are local objects and they are gonna be moved from implicitly anyway