I am not s开发者_运维技巧ure about a good way to initialize a shared_ptr that is a member of a class. Can you tell me, whether the way that I choose in C::foo() is fine, or is there a better solution?
I have code that uses raw pointers throughout. It needs to call a method that takes the raw pointer into a shared_ptr.
Suppose I have a class Boda: class Boda { ... }; And I have a member cydo in this class that I want to be a smart pointer (that is, I want it to get deallocated automatically as soon as the class g
A set of APIs that I commonly use follow a linked-list pattern: struct SomeObject { const char* some_value;
Hi I asked a question today about How to insert different types of objects in the same vector arrayand my code in that question was
I would like to use boost::shared_ptr<> to encapsulate the lifetime management of a handle. My handle and it\'s creation/destruction functions are declared like this:
I work on a cross-platform (Windows, Linux, Solaris) project. I want to use Boost\'s shared_ptr in this project.
I\'ve been writing a test case program to demonstrate a problem with a larger program of mine, and the tes开发者_开发百科t case has a bug that the original program does not.
I am mostly a C++ developer, recently I am writing iPhone applications. The memory management on iPhone is OK to me, due to resource limitation, it\'s encouraged to use reference counters rather than
When a function takes a shared_ptr (from boost or C++11 STL), are you passing it: by const reference: void foo(const shared_ptr<T>& p)