<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;">Hello Stephane,<div><br></div><div>Thank you for considering contributing this upstream.</div><div><br></div><div>So your suggestions to change:</div><div><br></div><div>dynamic_cast<SomeOtherType*>(smartPointer.GetPointer())</div><div><br></div><div>to</div><div><br></div><div>itk::DynamicCast<SomeOtherType>(smartPointer)</div><div><br></div><div><br></div><div>While this may save a few characters on a line I am not sure it is worth the trouble. </div><div><br></div><div><br></div><div><br></div><div>Also the declaration of ConstCast could use some additional consideration. You may only want one template parameter, there T1 and T2 are always the same. The const_cast operator does not do any other type conversion other than changing the const qualifier or volatile, so this template parameter change would help to enforce that.</div><div> </div><div><br></div><div>Brad</div><div><br></div><div><br><div><div>On Feb 27, 2015, at 4:54 AM, Stéphane ALBERT <<a href="mailto:otb.salbert@gmail.com">otb.salbert@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><div><div><div><div><div>Hello,<br><br></div>I wrote dynamic_cast<>() and const_cast<>() like operators to work with itk::SmartPointer<> for the OTB/Monteverdi2 project.<br><br></div>I think they could be contributed to ITK (for example in the itkSmartPointer.h header file).<br><br></div>You will find enclosed a itkCasts.h file with the source code of these operators. This file is an extract from: <a href="http://hg.orfeo-toolbox.org/Monteverdi2/file/df0184bc51a3/Code/Common/Core/mvdTypes.h#l63">http://hg.orfeo-toolbox.org/Monteverdi2/file/df0184bc51a3/Code/Common/Core/mvdTypes.h#l63</a> .<br><br></div>Best regards,<br><br></div>Stéphane<br clear="all"><div><br>-- <br><div class="gmail_signature"><div dir="ltr"><div dir="ltr"><pre cols="72"><a href="http://orfeo-toolbox.org/" target="_blank">http://orfeo-toolbox.org</a>

Stéphane ALBERT
Ingénieur d'études et développement
Business Unit E-SPACE & Geo Information, Département APPLICATIONS

CS Systèmes d'Information
Parc de la Grande Plaine - 5, Rue Brindejonc des Moulinais - BP 15872
31506 Toulouse Cedex 05 - France<br><br></pre></div></div></div>
</div></div>
<span><itkCasts.h></span>_______________________________________________<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://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://public.kitware.com/mailman/listinfo/insight-developers<br></blockquote></div><br></div></body></html>