gracicot@discuss.tchncs.de to C++@discuss.tchncs.deEnglish · 1 year agoThe 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-square6fedilinkarrow-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@discuss.tchncs.de to C++@discuss.tchncs.deEnglish · 1 year agomessage-square6fedilinkcross-posted to: cpp@programming.devcpp@programming.dev
minus-squaregracicot@discuss.tchncs.deOPlinkfedilinkEnglisharrow-up1·1 year agoI 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-squaretunetardis@lemmy.calinkfedilinkEnglisharrow-up1·1 year agoWell 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?
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
test3
example FTA gives a case where NRVO would not happen because of the conditional return value. Are you suggesting that you need notstd::move
even in this case?