English
Summary
Conclusions
An owner is responsible for releasing a resource exactly once. Copying and moving have different contracts for the source. RAII ties cleanup to the lifetime of an object. The rule of zero separates the model from manual ownership.
Self-check questions
- How does copying an address differ from copying a value?
- When is the copy constructor called, and when is assignment called?
- Why does std::move not transfer a resource by itself?
- What does noexcept promise?
- What state can you expect from a moved-from string?
- Why is a named T&& parameter an lvalue expression?
- How does copy-and-swap provide the strong guarantee?
- How does NRVO differ from guaranteed copy elision?
- Why can return std::move(local) prevent NRVO?
- Which special member functions does the rule of five cover?
- When should copying be explicitly deleted?
- Why must a guard not outlive the state it protects?
- How do you test self-move?
- Why does an empty buffer need a separate branch?
- What properties does an ordinary assert test not prove?