I\'m using enable_shared_from_this<Base> and then inherit from Base. When trying to use 开发者_开发技巧shared_from_this() in Derived\'s constructor (not initializer list), I get an exception. Tu
I\'ve got a type which inherits from enable_shared_from_this<type>, and another type that inherits from this type. Now I can\'t use the shared_from_this method because it returns the base type a
I have a function as follows void a(shared_ptr<X> val) {...} Sometimes, I want to pass in a heap-allocated object
I currently have something similar to the following: class Parent { //just a single child... for sake of simplicity
Right now, object ownership/deletion in my C++ project is manually tracked (via comments mostly). Almost every heap allocated object is created using a factory of sorts
Given the following: struct Foo { int bar() const; }; struct IsEqual : public std::unary_function<Foo*, bool>
I\'m just getting used to smart pointers using std::auto_ptr. Assume that I want to call a function with both auto_ptr and normal Pointers.
I am looking for a simple way to reduce header coupling in a C++ project, which comes mostly due to (overused) class composition which of course requires complete type. For example:
I\'m just toying around with the smart pointers in the upcoming new c++ standard. However I fail to grasp the usage of the shared_from_this function. Here is what I have:
Suppose I have these classes: struct Engine { int engine_data; }; struct Car { shared_ptr<Engine> engine;