[Insight-users] Operator for VariableLengthVector
Karthik Krishnan
karthik.krishnan at kitware.com
Thu Dec 13 12:26:21 EST 2007
Thanks for the report. Fixed in CVS
/cvsroot/Insight/Insight/Code/Common/itkVariableLengthVector.h,v <--
itkVariableLengthVector.h
new revision: 1.12; previous revision: 1.11
--
Karthik Krishnan
R&D Engineer,
Kitware Inc.
On 12/13/07, Emmanuel Christophe <emmanuel.christophe at gmail.com> wrote:
>
> Hi,
>
> I noticed that the operator / for VariableLengthVector (in
> itkVariableLengthVector.h) is defined as (as well as most operator):
>
> template< class T > inline Self operator/( T s ) const
> {
> Self result( m_NumElements );
> for( ElementIdentifier i=0; i< m_NumElements; i++ )
> {
> result[i] = m_Data[i] / (static_cast< ValueType >( s ));
> }
> return result;
> }
>
> Wouldn't it make more sense to apply the cast after the operation, as:
> result[i] = static_cast< ValueType >( m_Data[i] / s );
>
> In the situation where the VariableLengthVector is templated on int
> and s on double, the result would be closer to what is expected by the
> user.
>
> Regards,
> Emmanuel
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20071213/55c6713d/attachment.html
More information about the Insight-users
mailing list