[Insight-users] itkSTLContainerAdaptorTest - fix for Borland

Luis Ibanez luis.ibanez@kitware.com
Wed, 27 Nov 2002 14:43:43 -0500


Hi Dean, Ofri,


Playing a bit more with Borland 5.5 shows that
replacing "static_cast" with "dynamic_cast"
helps the compiler to swallow the statement.

It even pass the test.

This will allow to keep the derivation private.


   Luis


============================================
Dean Inglis wrote:

> Hi,
> 
> can you test (on other platforms) the following casting in
> Insight/Code/Common/itkVectorContainer.h: lines 103, 107
> 
>   /** Cast the container to a STL container type */
>   STLContainerType & CastToSTLContainer() {
>      return static_cast<STLContainerType
> &>(static_cast<STLContainerType>(*this)); }
> 
>   /** Cast the container to a const STL container type */
>   const STLContainerType & CastToSTLConstContainer() const {
>      return static_cast<const STLContainerType
> &>(static_cast<STLContainerType>(*this)); }
> 
> and
> Insight/Code/Common/itkMapContainer.h: lines 95, 99
> 
>   /** Cast the container to a STL container type */
>   STLContainerType & CastToSTLContainer() {
>      return static_cast<STLContainerType
> &>(static_cast<STLContainerType>(*this)); }
> 
>   /** Cast the container to a const STL container type */
>   const STLContainerType & CastToSTLConstContainer() const {
>      return static_cast<const STLContainerType
> &>(static_cast<STLContainerType>(*this)); }
> 
> 
> A ctest -R run of the test gives:
> 
> Changing directory into c:\Builder\itkRelease\Testing\Code\Common
> Testing itkSTLContainerAdaptorTest     Error, iteration on containers didn't
> finished simultaneously
> ***Failed
> Testing the VectorContainer ----- Testing non-const Adaptor
> VectorContainer (009852C8)
>   Reference Count: 1
>   Modified Time: 1
>   Debug: Off
>   Observers:
>     none
> 
> Testing assignment... Passed !
> Testing index access...
> 
> 
> 
> 0% tests passed, 1 tests failed out of 1
> 
> The following tests FAILED:
> 	itkSTLContainerAdaptorTest
> 
> 
> regards,
> Dean
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-users
> 
>