Quantcast
Channel: Use of enable_shared_from_this with multiple inheritance - Stack Overflow
Browsing index pages (2 articles)

Use of enable_shared_from_this with multiple inheritance

BI am using enable_shared_from_this in my code, and I am not sure if its usage is correct. This is the code: class A: public std::enable_shared_from_this<A> { public: void foo1() { auto ptr =...

View Article


Answer by Offirmo for Use of enable_shared_from_this with multiple inheritance

Indeed you are doing it wrong. If you have simple inheritance, just inherit from enable_shared_from this in the base class, and derived class get it for free. (of course you'll need to downcast the...

View Article

Browsing index pages (2 articles)


Latest Images