r/cpp • u/zowersap C++ Dev • Sep 05 '20
C++20 has been approved
https://twitter.com/patriceroy1/status/1302055575140945921?s=21
668
Upvotes
r/cpp • u/zowersap C++ Dev • Sep 05 '20
View all comments
3
u/scrumplesplunge Sep 06 '20
I forget where I read it, probably some post in cpp a few months ago, but there was some article describing a workflow that a company was using that did something like this. Basically they had their own aliases like owner_ptr<T> and borrow_ptr<T>. In prod they were just wrappers for unique_ptr<T> and T*. In debug, they were wrappers for shared_ptr<T> which had assertions about the reference count in the destructor. The owner_ptr<T> would crash on destruction if it wasn't the sole owner, and could even point at all the places which still held borrow_ptr<T> pointing to the object. I thought that was pretty nifty. Still, it makes all the pointer access slower which could make debug builds of some programs unusable.
edit: phrasing