From 386382c86e370a0974e5206ec91c7559b8258e91 Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 22 Mar 1999 15:53:54 +0000 Subject: [PATCH] Add a conversion constructor to the Vector class and disable it immediately again since egcs does not honour the 'explicit' keyword for constructors if they are templated. git-svn-id: https://svn.dealii.org/trunk@1033 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/vector.h | 18 ++++++++++++++++++ deal.II/lac/include/lac/vector.templates.h | 19 +++++++++++++++++++ deal.II/lac/source/vector.cc | 4 ++++ 3 files changed, 41 insertions(+) diff --git a/deal.II/lac/include/lac/vector.h b/deal.II/lac/include/lac/vector.h index 65b5ece2a5..50e2e21ea0 100644 --- a/deal.II/lac/include/lac/vector.h +++ b/deal.II/lac/include/lac/vector.h @@ -92,6 +92,24 @@ class Vector { * all components are copied from V */ Vector (const Vector& V); + + +// note: I disabled this function for the time being, since egcs1.1.2 +// does not respect the "explicit" keyword for template constructors. +// this leads to unwanted conversions and in some places to automatically +// generated temporaries, where this is not a good idea +// /** +// * Copy constructor taking a vector of +// * another data type. This will fail if +// * there is no conversion path from +// * #OtherNumber# to #Number#. Note that +// * you may lose accuracy when copying +// * to a vector with data elements with +// * less accuracy. +// */ +// template +// explicit +// Vector (const Vector &v); /** * Constructor. Set dimension to #n# and diff --git a/deal.II/lac/include/lac/vector.templates.h b/deal.II/lac/include/lac/vector.templates.h index 7a8205afb8..d5d6f360f4 100644 --- a/deal.II/lac/include/lac/vector.templates.h +++ b/deal.II/lac/include/lac/vector.templates.h @@ -53,6 +53,25 @@ Vector::Vector (const Vector& v) : +// see the .h file for why this function was disabled +// +// template +// template +// Vector::Vector (const Vector& v) : +// dim(v.size()), +// maxdim(v.size()), +// val(0) +// { +// if (dim) +// { +// val = new Number[maxdim]; +// Assert (val != 0, ExcOutOfMemory()); +// copy (v.begin(), v.end(), begin()); +// } +// } + + + template void Vector::reinit (const unsigned int n, const bool fast) { if (n==0) diff --git a/deal.II/lac/source/vector.cc b/deal.II/lac/source/vector.cc index f825a49e60..7f7a262fd6 100644 --- a/deal.II/lac/source/vector.cc +++ b/deal.II/lac/source/vector.cc @@ -5,3 +5,7 @@ // explicit instantiations template class Vector; template class Vector; + +// see the .h file for why these functions are disabled. +// template Vector::Vector (const Vector& v); +// template Vector::Vector (const Vector& v); -- 2.39.5