Commit 9879b9af authored by Stefan Philips's avatar Stefan Philips

[ADD] Allow cast from WValue to WMatrixFixed with Cols=1

parent bf49e3e4
......@@ -51,6 +51,8 @@
#include "../../exceptions/WOutOfBounds.h"
#include "../WValue.h"
/**
* Macro for handling the value store template.
*/
......@@ -284,6 +286,22 @@ public:
setValues( m.m_values );
}
/**
* Casting constructor for WValue. This won't compile if Cols != 1 and
* causes a runtime assertion if val.size() != Rows.
*
* \param val the WValue with the fitting size.
*/
WMatrixFixed( const WValue< ValueT >& val ) // NOLINT - we do not want it explicit
{
WAssert( val.size() == Rows, "The size of the given WValue doesn't equal the number of rows." );
// NOTE: The static Cols == 1 check is done by operator []
for( size_t i = 0; i < Rows; i++ )
{
operator[]( i ) = val[ i ];
}
}
/**
* Returns an identity matrix.
*
......
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