Index: code/branches/cpp11_v2/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/controllers/FormationController.cc	(revision 10817)
+++ code/branches/cpp11_v2/src/orxonox/controllers/FormationController.cc	(revision 10821)
@@ -440,8 +440,8 @@
                 if(newMaster->slaves_.size() > this->maxFormationSize_) continue;
 
-                for(std::vector<FormationController*>::iterator itSlave = this->slaves_.begin(); itSlave != this->slaves_.end(); itSlave++)
+                for(auto & elem : this->slaves_)
                 {
-                    (*itSlave)->myMaster_ = newMaster;
-                    newMaster->slaves_.push_back(*itSlave);
+                    (elem)->myMaster_ = newMaster;
+                    newMaster->slaves_.push_back(elem);
                 }
                 this->slaves_.clear();
@@ -486,5 +486,5 @@
             int i = 1;
 
-            for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
+            for(auto & elem : slaves_)
             {
                 pos = Vector3::ZERO;
@@ -497,6 +497,6 @@
                     dest+=FORMATION_LENGTH*(orient*WorldEntity::BACK);
                 }
-                (*it)->setTargetOrientation(orient);
-                (*it)->setTargetPosition(pos);
+                (elem)->setTargetOrientation(orient);
+                (elem)->setTargetPosition(pos);
                 left=!left;
             }
@@ -569,8 +569,8 @@
         if(this->state_ != MASTER) return;
 
-        for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
-        {
-            (*it)->state_ = FREE;
-            (*it)->myMaster_ = nullptr;
+        for(auto & elem : slaves_)
+        {
+            (elem)->state_ = FREE;
+            (elem)->myMaster_ = nullptr;
         }
         this->slaves_.clear();
@@ -584,10 +584,10 @@
         if(this->state_ != MASTER) return;
 
-        for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
-        {
-            (*it)->state_ = FREE;
-            (*it)->forceFreedom();
-            (*it)->targetPosition_ = this->targetPosition_;
-            (*it)->bShooting_ = true;
+        for(auto & elem : slaves_)
+        {
+            (elem)->state_ = FREE;
+            (elem)->forceFreedom();
+            (elem)->targetPosition_ = this->targetPosition_;
+            (elem)->bShooting_ = true;
 //             (*it)->getControllableEntity()->fire(0);// fire once for fun
         }
@@ -650,7 +650,7 @@
             this->slaves_.push_back(this->myMaster_);
             //set this as new master
-            for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
-            {
-                 (*it)->myMaster_=this;
+            for(auto & elem : slaves_)
+            {
+                 (elem)->myMaster_=this;
             }
             this->myMaster_=nullptr;
@@ -694,9 +694,9 @@
         if (this->state_ == MASTER)
         {
-            for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)
-            {
-                 (*it)->formationMode_ = val;
+            for(auto & elem : slaves_)
+            {
+                 (elem)->formationMode_ = val;
                  if (val == ATTACK)
-                     (*it)->forgetTarget();
+                     (elem)->forgetTarget();
             }
         }
Index: code/branches/cpp11_v2/src/orxonox/controllers/WaypointController.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/controllers/WaypointController.cc	(revision 10817)
+++ code/branches/cpp11_v2/src/orxonox/controllers/WaypointController.cc	(revision 10821)
@@ -44,8 +44,8 @@
     WaypointController::~WaypointController()
     {
-        for (size_t i = 0; i < this->waypoints_.size(); ++i)
+        for (auto & elem : this->waypoints_)
         {
-            if(this->waypoints_[i])
-                this->waypoints_[i]->destroy();
+            if(elem)
+                elem->destroy();
         }
     }
