<div class="gmail_quote">On Mon, Aug 30, 2010 at 4:49 AM, Antonin Perrot-Audet <span dir="ltr"><<a href="mailto:antonin07130@gmail.com">antonin07130@gmail.com</a>></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<InputImageType> itkFilterType;<br>
typedef typename itkFilterType::Pointer itkFilterTypePointer;<br>
<br>
static_cast<itkFilterTypePointer>(m_itkFilter);<br>
<br>
Is there a way to do it ? The problem is that my class mustn't be template. There is only one template function : to set the input of the filter.<br></blockquote><div><br>itkFilterTypePointer pDerived = static_cast< itkFilterType *>(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't go out of scope.<br>
<br></div></div><br>