Question OOP-CTOR-0069
HardWhat is the copy-and-swap idiom?
- A.
Swapping two objects' names
- B.
Copying memory with memcpy
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Constructors and Destructors question
What is the copy-and-swap idiom?
Swapping two objects' names
Copying memory with memcpy
Sign up free to see the answer and a step-by-step explanation.
Implementing assignment by copying the argument and swapping its contents with *this, giving strong exception safety
A way to avoid constructors