From 88bf3cbbb38a1f83744e9859ca16687f9a90f88a Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Wed, 9 Sep 2020 16:14:07 -0400
Subject: [PATCH] GeneratorObjects: Fix cppcheck warnings.

 - Prefer preincrement to postincrement for iterators.
---
 .../GeneratorObjects/GeneratorObjects/McEventCollection.h  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Generators/GeneratorObjects/GeneratorObjects/McEventCollection.h b/Generators/GeneratorObjects/GeneratorObjects/McEventCollection.h
index bc193502de5..a96d9b13848 100644
--- a/Generators/GeneratorObjects/GeneratorObjects/McEventCollection.h
+++ b/Generators/GeneratorObjects/GeneratorObjects/McEventCollection.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
 #ifndef GENERATOROBJECTSMCEVENTCOLLECTION_H
@@ -62,10 +62,9 @@ inline McEventCollection& McEventCollection::operator=(const McEventCollection&
 {
   // Force a deep copy on the DataVector
   //
-  for (EventConstIterator iter = in.begin();
-       iter != in.end(); iter++)
+  for (const HepMC::GenEvent* ev : in)
   {
-    DataVector<HepMC::GenEvent>::push_back(new HepMC::GenEvent(**iter));
+    DataVector<HepMC::GenEvent>::push_back(new HepMC::GenEvent(*ev));
   }
 
   return *this;
-- 
GitLab