297
I love Rust (lemmy.blahaj.zone)
you are viewing a single comment's thread
view the rest of the comments
[-] qaz@lemmy.world 4 points 1 month ago* (last edited 1 month ago)

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

[-] flying_gel@lemmy.world 1 points 1 month 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.

this post was submitted on 15 Nov 2024
297 points (93.3% liked)

Programmer Humor

32706 readers
663 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS