vtkSmartPointer<MyClass>

Hi,

I would like to pass a regular c++ class to my vtkSmartPointer object, obviously I have difficulty to compile it! What I did I drived it from vtkObject
class:

class vtkFile  : public vtkObject {

private:
std>>vector<std::string>  s;

public:
     vtkFile().  : s({1","2"}){}
     ~vtkFile(){}
};

I still get errors :
canot convert from ‘initializer list’ to 'vtkSmartPointer
no constructor could take the source the, or constructor overload was ambigious

Any help appreciated!

Regards,
sag

I don’t see any code involving a vtkSmartPointer here.
Moreover, constructor/destructor should be protected, and you have to use vtkTypeMacro(vtkFile, vtkObject);.
Have a look at any existing vtk class.

Hi Michael,

I am trying to use vtkTypeMacro but I cannot find the header for this ? would you by any chance know what it is, I get compiler error visual studio 2017!

Regards,
sag

Hi Michael,

I did find the vtkTest example and I am working on that, it is compiling now. I appreciate you attention to this question

Regards,
sag

vtkTypeMacro is in vtkSetGet.h

1 Like

Thanks Cheng!

Can you possibly share your code please? I am having trouble doing this also.
Thanks!