Commit a46364f9 authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[FIX] WMatrixFixed less operator now produce a lexicographically correct ordering

parent b0b2ce9c
......@@ -997,11 +997,11 @@ public:
bool operator==( const WMatrixFixed< RHSValueT, Rows, Cols, RHSValueStoreT >& rhs ) const throw()
{
bool eq = true;
for ( size_t row = 0; row < Rows; ++row )
for ( size_t row = 0; eq && ( row < Rows ); ++row )
{
for ( size_t col = 0; col < Cols; ++col )
for ( size_t col = 0; eq && ( col < Cols ); ++col )
{
eq &= ( operator()( row, col ) == rhs( row, col ) );
eq = eq && ( operator()( row, col ) == rhs( row, col ) );
}
}
return eq;
......@@ -1018,15 +1018,17 @@ public:
template< typename RHSValueT, ValueStoreTemplate RHSValueStoreT >
bool operator<( const WMatrixFixed< RHSValueT, Rows, Cols, RHSValueStoreT >& rhs ) const throw()
{
bool less = true;
for ( size_t row = 0; row < Rows; ++row )
bool eq = true;
bool result = true;
for ( size_t row = 0; eq && ( row < Rows ); ++row )
{
for ( size_t col = 0; col < Cols; ++col )
for ( size_t col = 0; eq && ( col < Cols ); ++col )
{
less &= ( operator()( row, col ) < rhs( row, col ) );
eq = eq && ( operator()( row, col ) == rhs( row, col ) );
result = ( operator()( row, col ) < rhs( row, col ) );
}
}
return less;
return result;
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment