Woes of Scope Guards and Unique_Resource - 5+ years in the making
summary
A generic RAII wrapper (unique_resource) evolves through ~13 papers and nine major revisions, adding CTAD, if constexpr paths and scope guards (scope_exit/scope_fail/scope_success). Stress tests that force throwing/copying deleters and move operations expose a double delete bug after 10+ iterations; fixes introduce careful conditional copy/move semantics to avoid double release and leaking. Committee feedback flags surprising cases like dangling references from lambdas capturing returned/moved-from locals; implementation and optimization (EBO / no_unique_address) remain library-impl responsibilities and standardization is still pending.
AI-written summary · about
chapters (16)
- 0:00Introduction and speaker intro
- 1:02History of resource management
- 8:16RAII and C++ features
- 13:25Standard thread RAII issues
- 15:57Tracer classes and debugging
- 17:25Java C# influence on C++
- 18:28Unique pointer limitations
- 23:54Unique resource proposal
- 27:33Scope guards and Andrei Alexandrescu
- 36:11Generic RAII wrapper complexity
- 42:52Move constructor specification
- 49:36Feedback and standardization challenges
- 51:01Should you write RAII wrappers
- 52:46Key takeaways on RAII
- 55:20Tool Time and closing remarks
- 56:02Q&A session
related talks
01h 33mSafe and Sane C++ Types
01h 39m“Leak-Freedom in C++... By Default.”
56mEfficient and Reliable Wrapping of C APIs Using Modern C++
04mErrors: forgotten, but not gone
01h 01mGetting Allocators out of Our Way
01h 22mThese 10 tricks that only library implementors know!
01h 09mRe-Release: Missing (and future?) C++ Range Concepts
01h 01mAllocators: The Good Parts
