However, in DEBUG builds, add a `std::unique_ptr&` member. Ctor increments member's `borrow_count`, dtor decrements it. 4/6
-
-
Replying to @fitzgen
Finally, `std::unique_ptr`'s dtor asserts that its `borrow_count` is 0, in DEBUG builds. 5/6
1 reply 1 retweet 1 like -
Replying to @fitzgen
Extending with const and mut borrows is an exercise left to the reader. Fin. 6/6
1 reply 0 retweets 0 likes -
Replying to @fitzgen
How is `borrowed_ptr` better than using `std::unique_ptr&`? 7/6
2 replies 1 retweet 0 likes -
Replying to @fitzgen
You know if your borrows are wrong before you have to debug stack/heap corruption. 8/6
1 reply 0 retweets 0 likes -
Replying to @fitzgen
Additionally, (subjectively) reads better and makes it SUPER EXTRA EXPLICIT what ownership is. 9/6
1 reply 0 retweets 0 likes -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.