Company
Date Published
Author
Phil Nash
Word count
1712
Language
English
Hacker News points
None

Summary

C++ developers need to understand categories of types such as Resource Managers that directly manage a resource. There are three sub-categories of Resource Manager: Scoped, Unique and General. Scoped Managers are non-copyable and non-moveable, with custom constructors for acquiring resources and deleted copy and move operations. Unique Resource Managers implement move construction and/or move-assignment, while General Resource Managers are both copyable and value-like, adding indirection to the resource they manage. The "Rule of DesDeMovA" provides a way to create non-copyable, non-moveable types with custom destructors by deleting the move-assignment operator. Understanding these categories and rules can help developers write more efficient and effective code.