From: Luca Heltai Date: Tue, 28 Jul 2009 09:06:06 +0000 (+0000) Subject: Added implicit conversion from VectorView to const Vector X-Git-Tag: v8.0.0~7442 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11b54e7ceda94217e918723f1c6eda9c4d8b4ad7;p=dealii.git Added implicit conversion from VectorView to const Vector git-svn-id: https://svn.dealii.org/trunk@19123 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/vector_view.h b/deal.II/lac/include/lac/vector_view.h index c655384bef..7060bdefd6 100644 --- a/deal.II/lac/include/lac/vector_view.h +++ b/deal.II/lac/include/lac/vector_view.h @@ -164,6 +164,15 @@ 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 @@ -275,6 +284,13 @@ VectorView::~VectorView() } +template +inline +VectorView::operator const Vector &() const +{ + return static_cast &> (*this); +} + template inline