Talk:cpp/memory/shared ptr
For some reason, in the "Implementation Notes" section, the link to "allocate_shared" links to "http://en.cppreference.com/w/cpp/memory/shared_ptr/allocate_sharod", 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 http://en.cppreference.com/w/cpp/memory/shared_ptr/allocate_shared 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)
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. --31.18.70.70 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)
std::shared_ptr for arrays from libfun1 was approved by LWG to merge into C++17, but the wording didn't match up and the editor bumped this part back to LWG for a more precise wording.. Should we undo the changes here? It's pretty certain it will be part of C++17 since it passed all approvers, it was just a merge conflict. (note; the changes were [1] [2] [3] [4] [5], [6], [7], [8], [9], [10], [11], [12], and new pages cpp/memory/shared_ptr/operator_at and Template:cpp/memory/shared ptr/dsc operator at ) --Cubbi (talk)