Talk:cpp/memory/weak ptr/weak ptr
It seems a little funny to use the word "ownership" with weak_ptr. I'd be concerned that people might confuse it with how e.g. a shared_ptr "owns" memory (and is responsible for cleaning it up). Are there any better words that might make that distinction clearer?
- Perhaps "shares the ownership" on this page is not the best wording, but in general, weak_ptr certainly deals with object ownership intimately: it shares the control block. --Cubbi 06:01, 9 April 2012 (PDT)
- That is certainly true. I guess I'd expect an object that owns a chunk of memory to be responsible for freeing that memory, which is why the word "ownership" scares me. Perhaps one way out of this is to be more explicit: instead of "shares ownership", how about "shares a control block"? 188.8.131.52 15:12, 9 April 2012 (PDT)
- We might as well describe everything relevant (shared_ptr, weak_ptr, make_shared/allocate_shared, enable_shared_from_this) in terms of control blocks. Although this is an implementation detail, it certainly makes it easier to discuss these things. A couple pictures would make it even better. --Cubbi 06:26, 11 April 2012 (PDT)
- I would vote for a middle ground. Current wording is certainly a bit confusing, but writing the description in terms of the control block isn't a perfect solution too, because the standard doesn't specify such things. Maybe improving the current wording and then mentioning the control block would be the best of the two worlds? -- P12 07:27, 11 April 2012 (PDT)
- Okay, I took a whack at this and changed "shares ownership" to "shares an object". Objections? Nate 05:58, 16 April 2012 (PDT)