<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Willi,<div><br></div><div>For classes which are container and hold objects using the SmartPointer direction is likely best. This is safest and will automatically maintain a reference count on the object you are containing. Now if you are putting them in an STL like container you may want to choose a list over a vector to minimize the copying of them, but that is a small detail that will really depend on how you are using the structure.</div><div><br></div><div>What do yo mean it's a "bad idea to copy [SmartPointers]"?</div><div><br></div><div>Inside tight loops ( things done on a per-pixel basis ), or places where the class already has a SmartPointer reference to the object, they don't need to be used.</div><div><br></div><div>Brad</div><div><br><div><div>On Mar 11, 2013, at 12:07 PM, Willi Huber <<a href="mailto:surfersparadise85-itk@yahoo.com">surfersparadise85-itk@yahoo.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<div><div style="background-color: rgb(255, 255, 255); font-family: tahoma, 'new york', times, serif; font-size: 10pt; "><div>Hello all,</div><div><br></div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">I am trying to write a Class that manages my data.</div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">The problem currently is that I am not aware how to use the itk::SmartPointer.</div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">I have read its usually a bad idea to copy them. Another idea was to
save the <span style="font-size: 10pt;">itk::SmartPointer* as suggested here: <a href="http://www.itk.org/pipermail/insight-users/2004-November/011095.html">http://www.itk.org/pipermail/insight-users/2004-November/011095.html</a>.</span></div><div style="font-size: 10pt; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; "><span style="font-size: 10pt;">The problem here is: Whenever the scope of the smartpointer creation is left the </span><span style="font-size: 10pt;">itk::SmartPointer* points to a the undefined RIP. And whenever I read any ITK manual it is strictly forbidden to use new.</span></div><div style="font-size: 10pt; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">So if anyone has just some time it would be nice to
come up with a solution for my problem. Am I the first having these problems or am I just not smart enough?</div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; "><br></div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">Cheers,</div><div style="font-size: 13px; font-family: tahoma, 'new york', times, serif; background-color: transparent; font-style: normal; ">Willi</div></div></div>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></blockquote></div><br></div></body></html>