From 68c577a193b59de366813d480ecc67988445f6ab Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <dmitri.naumov@ufz.de>
Date: Wed, 14 Aug 2013 21:39:24 +0200
Subject: [PATCH] Rewrite element loop using iterator.

---
 MeshLib/Mesh.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/MeshLib/Mesh.cpp b/MeshLib/Mesh.cpp
index 9febb4a1da9..80728f4b4e5 100644
--- a/MeshLib/Mesh.cpp
+++ b/MeshLib/Mesh.cpp
@@ -161,12 +161,11 @@ void Mesh::calcEdgeLengthRange()
 
 void Mesh::setElementNeighbors()
 {
-	const size_t nElements = _elements.size();
 	std::vector<Element*> neighbors;
-	for (unsigned m(0); m<nElements; ++m)
+	for (auto it = _elements.begin(); it != _elements.end(); ++it)
 	{
 		// create vector with all elements connected to current element (includes lots of doubles!)
-		Element *const element (_elements[m]);
+		Element *const element = *it;
 
 		const size_t nNodes (element->getNNodes());
 		for (unsigned n(0); n<nNodes; ++n)
-- 
GitLab