• qaz@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    8 days ago

    Is there a way to avoid having to write copy and move twice every time yet?

    • flying_gel@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      7 days ago

      You mean copy/move constructor and assignment operator?

      Unless you have any special handling the ones generated by the compiler automatically should work just fine. But if you do have to define them for some reason (which is becoming increasingly rare) you would need to define both if you need both copy/move construction and copy/move assignment.