weak-ptr
STL implementation of MVP design pattern
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.[详细]
2023-04-01 21:33 分类:问答static_pointer_cast for weak_ptr
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[详细]
2023-03-07 16:19 分类:问答std::shared_ptr and double callback
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[详细]
2023-02-26 13:16 分类:问答How does weak_ptr work?
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[详细]
2023-02-26 06:45 分类:问答Threading a Shared Model with pointers
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[详细]
2023-02-15 02:48 分类:问答C++ boost::shared_ptr & boost::weak_ptr & dynamic_cast
I have something like this: enum EFood{ eMeat, eFruit }; class Food{ }; class Meat: public Food{ void someMeatFunction();[详细]
2023-02-10 05:23 分类:问答shared_ptr and weak_ptr differences
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[详细]
2023-02-10 00:51 分类:问答Avoiding indirect cyclic references when using shared_ptr and weak_ptr
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[详细]
2022-12-17 09:07 分类:问答boost, shared ptr Vs weak ptr? Which to use when?
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.[详细]
2022-12-16 02:41 分类:问答