rule of five

The full name of the rule is the rule of 3/5/0.
* destructor
* copy constructor
* copy assignment operator
* move constructor
* move assignment operator

It doesn't say "always provide all five". It says that you have to either provide the three, the five, or none of them. 
The default constructors and assignment operators do shallow copy and we create our own constructor and assignment operators when we need to perform a deep copy.
Not implementing move semantics is not usually considered an error. If move semantics are missing, the compiler would normally use the less efficient copy operations wherever possible. If a class does not require move operations, we can easily skip those. But, implementing them results in increased efficiency.
Indeed, more often than not the smartest move is to not provide any of the five. But you can't do that if you're writing your own container, smart pointer, or a RAII wrapper around some resource.
* We can explicitly ask the compiler to generate the synthesized versions of the copy-control members by defining them as = default.
* Under the new standard, we can prevent copies by defining the copy constructor and copy-assignment by =deleted.
```
#include <iostream>
#include <cstring>
#include <utility>
using namespace std;

class Rules5 {
    char* str; 
public:
    Rules5(const char* s = "") : str(nullptr)  { 
        if (s) {
            size_t n = strlen(s) + 1;
            str = new char[n];      
            memcpy(str, s, n); 
        } 
    }
 
    ~Rules5() {
        delete[] str; // deallocate
    }
 
    Rules5(const Rules5& other) // copy constructor
    : Rules5(other.str) {}
 
    Rules5(Rules5&& other) noexcept // move constructor
    : str(exchange(other.str, nullptr)) {}
 
    Rules5& operator=(const Rules5& other) // copy assignment
    {
        return *this = Rules5(other);
    }
 
    Rules5& operator=(Rules5&& other) noexcept // move assignment
    {
        swap(str, other.str);
        return *this;
    }
};

int main() {
    Rules5 r;
    return 0;
}
```