I&#39;ve been following along with this conversation and following the example on the wiki, I tried to do this:<br><br>    vtkSmartPointer&lt;vtkMultiBlockPLOT3DReader&gt; m_Reader2;<br>    vtkSmartPointer&lt;vtkMultiBlockDataSet&gt; dataset = m_Reader2-&gt;GetOutput();<br>
<br>which gave me an error <br> error C2664: &#39;vtkSmartPointerBase::vtkSmartPointerBase(vtkObjectBase *)&#39; : cannot convert parameter 1 from &#39;vtkMultiBlockDataSet *&#39; to &#39;vtkObjectBase *&#39;<br><br>I can&#39;t seem to figure out why this is the case?<br>
<br><br><div class="gmail_quote">On Fri, Nov 6, 2009 at 4:03 PM, Alex Malyushytskyy <span dir="ltr">&lt;<a href="mailto:alexmalvtk@gmail.com">alexmalvtk@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Jeff,<br>
<div class="im"><br>
&gt; sp = NULL; // Release would happen here.<br>
</div>That was what I was looking for.<br>
When I tried to look at the code I forgot that vtkSmartPointer is<br>
dialing with vtkObjectBase pointers.<br>
<div class="im"><br>
&gt; Normally you just wait for the smart pointer to go out of scope.<br>
<br>
</div>Main reason for me to use smartpointers - it helps dealing with<br>
exceptions especially thrown from constructors.<br>
So I usually use smart pointers as a class members instead of raw pointers .<br>
And even though smartpointer will do his job when it goes out of scope,<br>
you may get situation when you need to replace the data when it does not.<br>
<br>
Example:<br>
Assume poly data is read from the file and stored with smartpointer.<br>
User action changes the data (for example some additional tessellation).<br>
If result is satisfactory, old data should be replaced.<br>
<br>
Thanks everybody for help,<br>
<font color="#888888">             Alex<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
<br>
On Fri, Nov 6, 2009 at 5:53 AM, Jeff Baumes &lt;<a href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a>&gt; wrote:<br>
&gt;&gt; The only thing is  not clear  for me is how to force smartpointer to<br>
&gt;&gt; release the data.<br>
&gt;&gt;<br>
&gt;<br>
&gt; Is this what you&#39;re looking for?<br>
&gt; vtkSmartPointer&lt;vtkType&gt; sp = vtkSmartPointer&lt;vtkType&gt;::New();<br>
&gt; ...<br>
&gt; sp = NULL; // Release would happen here.<br>
&gt; This would decrement the reference count of the object by one. If no one<br>
&gt; else holds a reference count of the object (i.e. reference count goes to<br>
&gt; zero), it will be released from memory.<br>
&gt; Normally you just wait for the smart pointer to go out of scope. If you<br>
&gt; explicitly need to make the reference go away at a certain point, you might<br>
&gt; as well not use smart pointers and just do this equivalent code:<br>
&gt; vtkType* p = vtkType::New();<br>
&gt; ...<br>
&gt; p-&gt;Delete();<br>
&gt; Jeff<br>
</div></div><div><div></div><div class="h5">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br>