[Insight-users] C2440 when reinterpret_cast-ing from base to specific class

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Dec 17 10:53:18 EST 2009


Le 16 déc. 09 à 22:44, itkvtk123 at gmx.net a écrit :

> Thank you. Your code
>
> reinterpret_cast<GradientDescentType*>(optimizer.GetPointer())- 
> >SetRelaxationFactor(0.5);
>
> did the trick.
> I knew that the pointer might be the reason, but I was not aware of  
> the GetPointer() function.
>

Just a comment on reinterpret_cast: you usually don't need it, and it  
is often very dangerous.
In that case, a dynamic_cast seems more appropriate to me.

Gaëtan

-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr  http://www.itk.org
http://www.mandriva.org  http://www.bepo.fr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091217/45e33e6c/attachment.pgp>


More information about the Insight-users mailing list