shared-ptr
Why does enable_shared_from_this embed a weak pointer instead of embedding the reference counter directly?
The enable_shared_from_this helper contains a weak pointer that is set when creating shared pointer to the object. That means there is the reference-count (allocated separately or together with the ob[详细]
2023-03-23 11:20 分类:问答How does one downcast a std::shared_ptr?
Consider: struct SomethingThatsABase { virtual bool IsChildOne() const { return false; } virtual bool IsChildTwo() const { return false; }[详细]
2023-03-22 20:31 分类:问答Why use one vs the other: `boost::shared_array` VS `boost::shared_ptr<std::vector>`?
So to deal with large blobs of memory either for an image or similar there are clea开发者_Python百科rly lots of options.[详细]
2023-03-22 14:15 分类:问答using shared_ptr<T> across libs with different CRTs
I am writing a library that includes an interface to return\\receive shared_ptr objects. Everything seemed just dandy until I was reminded that an application using my library could have a different[详细]
2023-03-22 03:04 分类:问答shared_ptr not defined when including from managed code
I\'m trying to write a managed wrapper (C++/CLI) around an unmanaged C++ static library and am having two problems:[详细]
2023-03-21 17:15 分类:问答Having typedef std::map<boost::shared_ptr<my_class>,my_description> how to return & shared_ptr from my function?
So I have such function: boost::shared_ptr<my_class> get_class_by_name(std::string name) { typedef std::map<boost::shared_ptr<my_class>, my_description> map_t;[详细]
2023-03-20 16:43 分类:问答C++ shared_ptr inheritance memory leak
I have a situation where I have a shared_ptr to base of a child class. When the shared_ptr goes to delete the pointer, only the parent destructor is being called.[详细]
2023-03-20 15:05 分类:问答Interface pattern with shared_ptr
I want to have the following class structure: #include <tr1/memory> class Interface; class Impl; class Impl[详细]
2023-03-20 02:25 分类:问答BOOST_FOREACH Iteration over boost::shared_ptr<list>
I\'m doing something similar to this item Correct BOOST_FOREACH usage? However, my returned list is wrapped in a boost::shared_ptr.If I do not assign the list to a variable before the BOOST_FOREACH l[详细]
2023-03-17 08:52 分类:问答shared_ptr from pointer
I have a class which can\'t be create开发者_Python百科d on heap and it has private destructor. But there is a function which returns a pointer to such constructed object. I want to make a shared poin[详细]
2023-03-17 07:42 分类:问答