[Insight-users] ITK SmartPointers and my own class.

Pete79 pkoniusz at hotmail.com
Thu Apr 15 20:25:01 EDT 2010


Dear all.

Can you give me a simple example how to wrap my own class to provide it with
Smart Pointer functionality? So far I've gathered I really need to inherit
from the LightObject class, what next?

Let's say I have got the following:
class MyClass: public LightObject
{
private:
int member;
public:
MyClass(int memberC) : member(memberC) {}
~MyClass() { do something; }
};

How can I wrap it up with SmartPointer?

typedef typename SmartPointer<MyClass> MyClassSPT;

What else?
When I instantiate it with:
MyClassSPT aaa=MyClass::New() it won't work fine I guess coz the constructor
of MyClass takes a parameter as its argument.

Can you give me the tips and snippets of the code which show how to deal
with it?

Many thanks,
Peter


-- 
View this message in context: http://old.nabble.com/ITK-SmartPointers-and-my-own-class.-tp28261973p28261973.html
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list