<div dir="ltr"><div><span style="background-color:rgb(249,249,249)"><font face="sans">vtkSmartPointer has nothing to do with neither deep or shallow copy.<br></font></span></div><div><br></div><div><font face="sans">if you assign vtk object to smartpointer the reference count of vtk object is incremented,</font></div><div><font face="sans">there is only one vtkObject in the memory. Once smartpointer is released (going out of scope  for example) vtk object reference count  it was pointing is decremented.</font></div><div><font face="sans">In another words <span style="background-color:rgb(249,249,249)"><font face="sans">vtkSmartPointer is like a normal pointer, which adds does reference couning.</font></span></font></div><div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br></font></span></font></div><div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans">Operations with smartpointer DO NOT copy any data related to the object they point to.</font></span></font></div><div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br></font></span></font></div><div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br></font></span></font></div><div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans">While deep and shalow copy are always performed with 2 different objects.<br></font></span></font></div><div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br></font></span></font></div><div><font face="sans"><span style="background-color:rgb(249,249,249)"><font face="sans"><br></font></span></font></div><div><font face="sans"><br></font></div><div><font face="sans"></font><br></div><div><span style="background-color:rgb(249,249,249)"></span></div><div><span style="background-color:rgb(249,249,249)"></span></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 24, 2018 at 3:19 PM Berti Krüger <<a href="mailto:berti_krueger@hotmail.com">berti_krueger@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>
<div id="m_8970809788956831463geary-body">
<div>Hello.</div>
<div><br>
</div>
<div>I (hopefully) already understand the difference between the ShallowCopy and the DeepCopy method (e.g. copying only the pointer vs. copying the pointer and the content pointed to).</div>
<div><br>
</div>
<div>But what i don't understand yet is, what is the difference between using the overloaded assignment operator of vtkSmartPointer and the ShallowCopy method, e.g. what is the difference between</div>
<div><br>
</div>
<div><br>
</div>
<div><font face="monospace"><font color="#204a87">vtkSmartPointer<vtkPolydata></font>
<font color="#a40000">myStrangePolydata</font> = <font color="#204a87">vtkSmartPointer<vtkPolydata></font>::<font color="#4e9a06">New()</font>;</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace"><font color="#a40000">myStrangePolydata</font> = <font color="#204a87">
vtkTransmogrifyFilter</font>-><font color="#204a87">GetOutput</font>();</font></div>
<div><font face="monospace"><br>
</font></div>
<div><br>
</div>
<div><font face="sans">and</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace"><br>
</font></div>
<div><span style="background-color:rgb(249,249,249)"><font face="monospace"><font color="#a40000">myStangePolydata</font>-><font color="#204a87">ShallowCopy</font>(<font color="#204a87">vtkTransmogrifyFilter</font>-><font color="#204a87">GetOutput</font>();</font></span></div>
<div><font face="monospace, monospace"><span style="background-color:rgb(249,249,249)"><br>
</span></font></div>
<div><font face="monospace, monospace"><span style="background-color:rgb(249,249,249)"><br>
</span></font></div>
<div><font face="monospace, monospace"><span style="background-color:rgb(249,249,249)"><br>
</span></font></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans">Does it make a difference to the reference count of the vtkSmartPointer?</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans">Thank you very much in advance.</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans"><br>
</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans">Cheers,</font></span></div>
<div><span style="background-color:rgb(249,249,249)"><font face="sans">Berti</font></span></div>
</div>
</div>

_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div>