C++ (Qt)struct SomeClass { .. QImage m_data; ..};
C++ (Qt)cow_ptr<SomeData> m_data;...m_data = new SomeDerivedData;
C++ (Qt)QSharedPointer<QImage> m_data;
C++ (Qt)class A {virtual foo () = 0;};class B : public A {virtual foo() {};}; struct C{ C () : a (new B) {} A *a;}
C++ (Qt)implicit_shared_ptr< Cow > cow = implicit_shared_ptr< MyCow >::make();
C++ (Qt)struct SomeClass { .. BaseData * m_data; // указатель на базовый класс ..};
C++ (Qt)template<class T>struct cow_ptr { ... T * operator -> ( void ); const T * operator -> ( void ) const; ...}; cow_ptr<SomeData> ptr(new SomeData);int a = ptr->mA; // позовет неконстантный ->, сволочь такая
C++ (Qt)template<class T>class MyPtr{ T *d; MyPtr(const MyPtr &other) : d(other.d->clone()) {}};
C++ (Qt)class SomeClass { SomeClassData : public QSharedData { MyPtr<BaseData> data; }; QSharedPointer<SomeClassData> d;};