Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 732 Bytes

README.md

File metadata and controls

13 lines (9 loc) · 732 Bytes

© A.Voß, FH Aachen, codebasedlearning.dev

Unit 0x06 - I Like to Move it Move it

Every new needs an owner. This unit follows a block of memory on the heap: who asks for it, and what goes wrong when nobody knows who deletes - a leak, a double delete, a copy that shares its owner. Then the owner becomes a type: unique_ptr, as small as a raw pointer, and with the same machine code. Ownership is handed on by a move, which steals the pointer instead of copying the elements - and shared by shared_ptr, which counts its owners.

Comments

Questions, improvements, or clever suggestions? Send friendly notes (and constructive critique) to me.