nn_shared_ptr needs lifetime-sharing constructors
artwyman opened this issue · 0 comments
artwyman commented
nn<> doesn't have the lifetime-sharing constructors for shared_ptr, which allow creating a new shared_ptr which shares its refcount with a shared_ptr (see (8) here).
Adding it would require some additional specialization (or accepting having some ctors which won't compile when used) since that constructor wouldn't be applicable to all pointer types (e.g. unique_ptr).
Meanwhile you can work around this by creating a normal shared_ptr, then converting it to nn<> using i_promise_i_checked_for_null. A helper function which does this might be a reasonable compromise.