• gracicot@discuss.tchncs.deOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    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.

    • tunetardis
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      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 not std::move even in this case?