Talk:cpp/memory/shared ptr


For some reason, in the "Implementation Notes" section, the link to "allocate_shared" links to "", both on hover, copy, and click. Looking at the markup, the referred-to page-name looks correctly spelt... I don't get it. Manually going to works.

It's a typo in MediaWiki:Simple-search-list and MediaWiki:Geshi-keyword-list-cpp, User:P12 can fix that. --Cubbi 11:45, 6 June 2012 (PDT)
Fixed. Thanks. -- P12 13:01, 6 June 2012 (PDT)

[edit] missing operator->*

Is there a reason why shared_ptr does not overload operator->*? That operator would ease the access of the pointee's member via "pointer to member":

I'd like to access them via shp->*member but that does not work, and I have to write (*shp).*member which looks awkward and unnaturally to me. -- 06:37, 15 December 2014 (PST)

You could also write shp.get()->*member or (&*shp)->*member if you want the correct operator to be called. Some early smart pointers overloaded ->*, but the boost implementation of shared_ptr, on which C++ is based, didn't. I see it was recently brought up on stackoverflow with no conclusive answer. --Cubbi (talk) 06:50, 15 December 2014 (PST)