This is my learning notes from the course - Mastering C++ Standard Library Features.
Rule of Five and Rule of Zero
- How to make sure that your classes properly expose move operations
- Rule of three (before C++11)
- Rule of five and rule of zero (C++11 and later)
Rule of Three
- Before C++11, the rule of three claims that:
- If you have a class explicitly defining one of the following:
- Destructor
- Copy constructor
- Copy assignment operator
- Then, it should probably define all three
- If you have a class explicitly defining one of the following:
- This prevents mistake and oversights when implementing classes that manage resources