<div class="gmail_quote">On Mon, Aug 30, 2010 at 4:49 AM, Antonin Perrot-Audet <span dir="ltr">&lt;<a href="mailto:antonin07130@gmail.com">antonin07130@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;">
<br>
But I get an invalid cast error<br>
<br>
<br>
itk::ProcessObject::Pointer m_itkFilter;<br>
[...]<br>
typedef itk::ImageToImageFilter&lt;InputImageType&gt; itkFilterType;<br>
typedef typename itkFilterType::Pointer itkFilterTypePointer;<br>
<br>
static_cast&lt;itkFilterTypePointer&gt;(m_itkFilter);<br>
<br>
Is there a way to do it ? The problem is that my class mustn&#39;t be template. There is only one template function : to set the input of the filter.<br></blockquote><div><br>itkFilterTypePointer pDerived = static_cast&lt; itkFilterType *&gt;(m_itkFilter.GetPointer());<br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Also I was wondering : would the smart pointer destroy itself (and the associated object) in the end of the function, even if it is stored as a member of the object ?<br></blockquote><div><br>no, if the class has the smartpointer as a member, it shouldn&#39;t go out of scope.<br>
<br></div></div><br>