I\'m trying to implement an MVP pattern using STL and I have used *shared_ptr* and *weak_ptr* for \"breaking the cycle\" when having recurrent references.
In c++0x, there is a std::static_pointer_cast for std::shared_ptr, but there is no equivalent method for开发者_如何学JAVA std::weak_ptr. Is this intentional, or an oversight? If an oversight, how woul
I have some logic where I am using std::shared_ptrs to objects in an inheritance hierarchy. At one point I need to handle these objects depending on their real type, so I am using a double dispatch (i
I understand how to use weak_p开发者_JAVA百科tr and shared_ptr. I understand how shared_ptr works, by counting the number of references in its object. How does weak_ptr work? I tried reading through t
I have a vector of pointers to objects created with new. Multiple threads access this vector 开发者_高级运维in a safe manner with various gets/sets. However, a thread may delete one of the objects, in
I have something like this: enum EFood{ eMeat, eFruit }; class Food{ }; class Meat: public Food{ void someMeatFunction();
I am reading Scott Meyers \"Effective C++\" book. It was mentioned that there are tr1::shared_ptr and tr1::weak_ptr act like built-in pointers, but they keep track of how many tr1::shared_ptrs point t
I\'m currently putting together an application that relies heavily on shared_ptr and everything looks good so far - I\'ve done my homework and have a pretty good idea of some of the pitfalls of using
In my current project I am using boost::shared_ptr quite exten开发者_C百科sively. Recently my fellow team mates have also started using weak_ptr. I don\'t know which one to use and when.