Hello all,<div><br></div><div>I've created a simple class, which is a subclass of vtkObject, and tried to use vtkSmartPointer with it. The class is as follows:</div><div><br></div><div><div>class MyClass : public vtkObject</div>
<div>{</div><div>public:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>MyClass()</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>std::cout << "BEING CONSTRUCTED" << std::endl;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>~MyClass()</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>std::cout << "BEING DESTRUCTED" << std::endl;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>};</div>
</div><div><br></div><div><br></div><div>And I'm trying to create a smart pointer for it like this:</div><div><br></div><div>vtkSmartPointer<MyClass> myPtr = vtkSmartPointer<MyClass>::New();</div><div><br>
</div><div>But the instantiation of the object/smartptr generates compiler errors.</div><div>Can anyone help me with that?</div><div><br></div><div>Compiling under Visual C++ 2008, my build log follows:</div><div><br></div>
<div><div>1>------ Build started: Project: TesteVTK, Configuration: Debug Win32 ------</div><div>1>Compiling...</div><div>1>TesteVTK.cpp</div><div>1>c:\users\vinicius\desktop\labmint\vtk\vtk-5.6.0\common\vtksmartpointer.h(113) : error C2665: 'vtkSmartPointer<T>::vtkSmartPointer' : none of the 4 overloads could convert all the argument types</div>
<div>1> with</div><div>1> [</div><div>1> T=MyClass</div><div>1> ]</div><div>1> c:\users\vinicius\desktop\labmint\vtk\vtk-5.6.0\common\vtksmartpointer.h(163): could be 'vtkSmartPointer<T>::vtkSmartPointer(T *,const vtkSmartPointerBase::NoReference &)'</div>
<div>1> with</div><div>1> [</div><div>1> T=MyClass</div><div>1> ]</div><div>1> while trying to match the argument list '(vtkObject *, vtkSmartPointerBase::NoReference)'</div>
<div>1> c:\users\vinicius\desktop\labmint\vtk\vtk-5.6.0\common\vtksmartpointer.h(112) : while compiling class template member function 'vtkSmartPointer<T> vtkSmartPointer<T>::New(void)'</div>
<div>1> with</div><div>1> [</div><div>1> T=MyClass</div><div>1> ]</div><div>1> c:\users\vinicius\documents\my dropbox\projetos\testevtk\testevtk.cpp(70) : see reference to class template instantiation 'vtkSmartPointer<T>' being compiled</div>
<div>1> with</div><div>1> [</div><div>1> T=MyClass</div><div>1> ]</div><div>1>Build log was saved at "file://c:\Users\Vinicius\Documents\Visual Studio 2008\Projects\TesteVTK\TesteVTK\Debug\BuildLog.htm"</div>
<div>1>TesteVTK - 1 error(s), 0 warning(s)</div><div>========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========</div></div><div><br></div><div><br></div><div><br></div><div>Thanks in advance.</div>