From a6c318dab0fe0de23c30ee2d63aaf7c98462d78a Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu, 1 Sep 2016 14:54:53 +0200 Subject: [PATCH] [MeL] Non-const PropertyVector::getComponent(). Allow modification of the component of the specified tuple. --- MeshLib/PropertyVector.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MeshLib/PropertyVector.h b/MeshLib/PropertyVector.h index 4f4ffdb1e6e..eef83543751 100644 --- a/MeshLib/PropertyVector.h +++ b/MeshLib/PropertyVector.h @@ -68,6 +68,15 @@ public: return std::vector<PROP_VAL_TYPE>::size() / _n_components; } + //! Returns the value for the given component stored in the given tuple. + PROP_VAL_TYPE& getComponent(std::size_t tuple_index, std::size_t component) + { + assert(component < _n_components); + assert(tuple_index < getNumberOfTuples()); + return this->operator[](tuple_index* getNumberOfComponents() + + component); + } + //! Returns the value for the given component stored in the given tuple. PROP_VAL_TYPE const& getComponent(std::size_t tuple_index, std::size_t component) const -- GitLab