From: bangerth Date: Fri, 13 Jul 2012 17:42:49 +0000 (+0000) Subject: Remove a conversion operator from VectorView to Vector. The problem is that X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=232b0ed8d980a2c6e584c219f09284aa81679d6f;p=dealii-svn.git Remove a conversion operator from VectorView to Vector. The problem is that this operator here: /** * Implicit cast to const * Vector. This cast * allows the use of this object * everywhere a const * Vector is required. */ operator const Vector &() const; will never be called as per the C++ standard because VectorView is derived from Vector and the standard says this: A conversion function is never used to convert a (possibly cv-qualified) object to the (possibly cv-qualified) same object type (or a reference to it), to a (possibly cv-qualified) base class of that type (or a reference to it), or to (possibly cv-qualified) void. Note the piece about the base class. In other words, the presence of the operator in the current implementation has no impact since it will never be called. This also fixes the following warning from ICC: /scratch/bangert/p/deal.II/1/deal.II/include/deal.II/lac/vector_view.h(173): warning #597: "dealii::VectorView::operator const dealii::Vector &() const [with Number=PetscScalar={double}]" will not be called for implicit or explicit conversions operator const Vector &() const; ^ detected during: instantiation of class "dealii::VectorView [with Number=PetscScalar={double}]" at line 925 of "/scratch/bangert/p/deal.II/1/deal.II/include/deal.II/lac/parallel_vector.h" instantiation of class "dealii::parallel::distributed::Vector [with Number=double]" at line 1023 of "/scratch/bangert/p/deal.II/1/deal.II/source/numerics/error_estimator.cc" instantiation of "void dealii::KellyErrorEstimator<1, spacedim>::estimate(const dealii::Mapping<1, spacedim> &, const DH &, const dealii::Quadrature<0> &, const dealii::FunctionMap::type &, const InputVector &, dealii::Vector &, const std::vector> &, const dealii::Function *, unsigned int, dealii::types::subdomain_id_t={unsigned int}, dealii::types::material_id_t={unsigned char}) [with spacedim=1, InputVector=dealii::parallel::distributed::Vector, DH=dealii::DoFHandler<1, 1>]" at line 156 of "/scratch/bangert/p/deal.II/1/deal.II/source/numerics/error_estimator.inst" git-svn-id: https://svn.dealii.org/trunk@25696 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/vector_view.h b/deal.II/include/deal.II/lac/vector_view.h index 440e6342b4..7dee882b19 100644 --- a/deal.II/include/deal.II/lac/vector_view.h +++ b/deal.II/include/deal.II/lac/vector_view.h @@ -163,15 +163,6 @@ class VectorView : public Vector * memory. */ ~VectorView(); - /** - * Implicit cast to const - * Vector. This cast - * allows the use of this object - * everywhere a const - * Vector is required. - */ - operator const Vector &() const; - /** * The reinit function of this object has * a behavior which is different from the @@ -298,14 +289,6 @@ VectorView::~VectorView() } -template -inline -VectorView::operator const Vector &() const -{ - return static_cast &> (*this); -} - - template inline void VectorView::reinit(const unsigned int N, const bool fast)