* U = V . Copy all components
*/
Vector<Number>& operator= (const Vector<Number>& V);
+
+ /**
+ * U = V for different types.
+ */
+ template<typename Number2>
+ Vector<Number>& operator= (const Vector<Number2>& V);
/**
* U = U * V . Scalar Produkt
template <typename Number>
-Vector<Number>& Vector<Number>::operator = (const Vector<Number>& v)
+Vector<Number>&
+Vector<Number>::operator = (const Vector<Number>& v)
{
if (v.dim != dim)
reinit (v.dim, true);
+template <typename Number>
+template<typename Number2>
+Vector<Number>&
+Vector<Number>::operator = (const Vector<Number2>& v)
+{
+ if (v.size() != dim)
+ reinit (v.size(), true);
+ if (dim!=0)
+ copy (v.begin(), v.end(), begin());
+
+ return *this;
+}
+
+
+
template <typename Number>
void Vector<Number>::print (FILE* f, const char* format) const
{
// explicit instantiations
template class Vector<double>;
+template Vector<double>& Vector<double>::operator=(const Vector<float>&);
+
template class Vector<float>;
+template Vector<float>& Vector<float>::operator=(const Vector<double>&);
// see the .h file for why these functions are disabled.
// template Vector<float>::Vector (const Vector<double>& v);
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams