]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Remove a conversion operator from VectorView to Vector. The problem is that
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 13 Jul 2012 17:42:49 +0000 (17:42 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 13 Jul 2012 17:42:49 +0000 (17:42 +0000)
this operator here:

                                     /**
                                      * Implicit cast to const
                                      * Vector<Number>. This cast
                                      * allows the use of this object
                                      * everywhere a const
                                      * Vector<double> is required.
                                      */
    operator const Vector<Number> &() const;

will never be called as per the C++ standard because VectorView is derived
from Vector<Number> 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<Number>::operator const dealii::Vector<PetscScalar={double}> &() const [with Number=PetscScalar={double}]" will not be called for implicit or explicit conversions
      operator const Vector<Number> &() const;
      ^
          detected during:
            instantiation of class "dealii::VectorView<Number> [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<Number> [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<spacedim>::type &, const InputVector &, dealii::Vector<float> &, const std::vector<bool, std::allocator<bool>> &, const dealii::Function<spacedim> *, unsigned int, dealii::types::subdomain_id_t={unsigned int}, dealii::types::material_id_t={unsigned char}) [with spacedim=1,
                      InputVector=dealii::parallel::distributed::Vector<double>, 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

deal.II/include/deal.II/lac/vector_view.h

index 440e6342b4d5b2b6c7ea4aede837600e6453a196..7dee882b190150709bc71d39f85e730680ee381b 100644 (file)
@@ -163,15 +163,6 @@ class VectorView : public Vector<Number>
                                       * memory. */
     ~VectorView();
 
-                                     /**
-                                      * Implicit cast to const
-                                      * Vector<Number>. This cast
-                                      * allows the use of this object
-                                      * everywhere a const
-                                      * Vector<double> is required.
-                                      */
-    operator const Vector<Number> &() const;
-
                                      /**
                                       * The reinit function of this object has
                                       * a behavior which is different from the
@@ -298,14 +289,6 @@ VectorView<Number>::~VectorView()
 }
 
 
-template<typename Number>
-inline
-VectorView<Number>::operator const Vector<Number> &() const
-{
-  return static_cast<const Vector<Number> &> (*this);
-}
-
-
 template<typename Number>
 inline
 void VectorView<Number>::reinit(const unsigned int N, const bool fast)

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


Typeset in Trocchi and Trocchi Bold Sans Serif.