Commit 69618fd6 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[ADD #453] copyconstructor from WValue with one template parameter to

another WValue with a differrent template parameter, e.g. float to double.
It might be slow.
parent 7cffe2e3
...@@ -39,6 +39,8 @@ namespace wmath ...@@ -39,6 +39,8 @@ namespace wmath
*/ */
template< typename T > class WValue template< typename T > class WValue
{ {
template< typename S > friend class WValue; //!< All WValues are friends of each other.
// We exclude this from doxygen since they are documented already as functions and I don't want to duplicate that documentation // We exclude this from doxygen since they are documented already as functions and I don't want to duplicate that documentation
// \cond // \cond
template< typename U > friend std::ostream& operator<<( std::ostream& os, const WValue< U > &rhs ); template< typename U > friend std::ostream& operator<<( std::ostream& os, const WValue< U > &rhs );
...@@ -64,6 +66,19 @@ public: ...@@ -64,6 +66,19 @@ public:
{ {
} }
/**
* Create a WValue as copy of the one given as parameter but with another template type.
* \param newValue The WValue to be copied.
*/
template< typename S > explicit WValue( const WValue< S >& newValue )
{
m_components.resize( newValue.m_components.size() );
for( size_t i = 0; i < m_components.size(); ++i )
{
m_components[i] = newValue.m_components[i];
}
}
/** /**
* Get number of components the value consists of. * Get number of components the value consists of.
*/ */
......
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