shared-ptr
Casting between shared_ptr of forward declared class hierarchy
I have a class manipulating only shared_ptr to an inheritance hierarchy (quite simple, there are a few classes, say A, B, C etc. inheriting from a single class Base). Since I do not need to manipulate[详细]
2023-04-04 17:20 分类:问答Can I use the type of "this" as a template argument (inside a macro)?
I currently have this: #define THIS(T) (boost::static_pointer_cast<T>(shared_from_this())) The macro is used in a method like this:[详细]
2023-04-04 08:11 分类:问答shared_ptr deletes the object
void ClassName::LocalMethod( ) { boost::shared_ptr<ClassName> classNamePtr( this开发者_如何学Python );[详细]
2023-04-03 17:07 分类:问答boost::shared_ptr parent <-> child communication
I am using boost::shared_ptr to organize my pointer data in my game engine. I tried to make a very short example to show my problem:[详细]
2023-04-03 07:33 分类:问答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 分类:问答boost.python expose function that returns vector<MyClass>
I\'m writing an extension module for Python in C++ and I am using boost.python. I want to expose a function that returns a vector<MyClass>. I\'m not exactly sure how to do this and how it will i[详细]
2023-04-01 15:02 分类:问答Auto delete object while cycling vector
I have an std::vector of objects and i cycle it calling some methods of the object. One of them will check a particular condition and if needed will delete itsef from the vector. The point is that era[详细]
2023-04-01 12:25 分类:问答How does shared_ptr work in if condition
In C++, I can write something like: shared_ptr<A> a_sp = someFunctionReturningSharedPtr(); if (a_sp) {[详细]
2023-03-31 04:45 分类:问答Does std::tr1::shared_ptr do mutual exclusion?
I have a class which contains a BYTE*, a reference counter and a CRITICAL_SECTION which protects both of them from concurrent access.[详细]
2023-03-31 01:42 分类:问答Changing a function to return a pointer
I\'m quite new to C++ and I have written the class and function below: class Person { public: boost::shared_ptr<Details> GetDetails(const std::string& name) const;[详细]
2023-03-30 14:10 分类:问答