Index: code/trunk/src/libraries/core/input/InputManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.cc	(revision 10624)
+++ code/trunk/src/libraries/core/input/InputManager.cc	(revision 11071)
@@ -39,5 +39,4 @@
 #include <ois/OISException.h>
 #include <ois/OISInputManager.h>
-#include <boost/foreach.hpp>
 #include <loki/ScopeGuard.h>
 
@@ -72,5 +71,5 @@
     InputHandler InputHandler::EMPTY;
 
-    InputManager* InputManager::singletonPtr_s = 0;
+    InputManager* InputManager::singletonPtr_s = nullptr;
 
     //! Defines the |= operator for easier use.
@@ -94,9 +93,9 @@
     InputManager::InputManager()
         : internalState_(Bad)
-        , oisInputManager_(0)
+        , oisInputManager_(nullptr)
         , devices_(2)
         , exclusiveMouse_(false)
-        , emptyState_(0)
-        , calibratorCallbackHandler_(0)
+        , emptyState_(nullptr)
+        , calibratorCallbackHandler_(nullptr)
     {
         RegisterObject(InputManager);
@@ -149,6 +148,6 @@
         // When loading the devices they should not already be loaded
         assert(internalState_ & Bad);
-        assert(devices_[InputDeviceEnumerator::Mouse] == 0);
-        assert(devices_[InputDeviceEnumerator::Keyboard] == 0);
+        assert(devices_[InputDeviceEnumerator::Mouse] == nullptr);
+        assert(devices_[InputDeviceEnumerator::Keyboard] == nullptr);
         assert(devices_.size() == InputDeviceEnumerator::FirstJoyStick);
 
@@ -210,5 +209,5 @@
         catch (const std::exception& ex)
         {
-            oisInputManager_ = NULL;
+            oisInputManager_ = nullptr;
             internalState_ |= Bad;
             ThrowException(InitialisationFailed, "Could not initialise the input system: " << ex.what());
@@ -294,6 +293,6 @@
 
         // Reset console commands
-        ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(0);
-        ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(0);
+        ModifyConsoleCommand(__CC_InputManager_name, __CC_calibrate_name).setObject(nullptr);
+        ModifyConsoleCommand(__CC_InputManager_name, __CC_reload_name).setObject(nullptr);
 
         orxout(internal_status, context::input) << "InputManager: Destruction complete." << endl;
@@ -310,16 +309,16 @@
         orxout(verbose, context::input) << "InputManager: Destroying devices..." << endl;
 
-        BOOST_FOREACH(InputDevice*& device, devices_)
-        {
-            if (device == NULL)
+        for (InputDevice*& device : devices_)
+        {
+            if (device == nullptr)
                 continue;
             const std::string& className = device->getClassName();
             delete device;
-            device = 0;
+            device = nullptr;
             orxout(verbose, context::input) << className << " destroyed." << endl;
         }
         devices_.resize(InputDeviceEnumerator::FirstJoyStick);
 
-        assert(oisInputManager_ != NULL);
+        assert(oisInputManager_ != nullptr);
         try
         {
@@ -331,5 +330,5 @@
                                                    << "Potential resource leak!" << endl;
         }
-        oisInputManager_ = NULL;
+        oisInputManager_ = nullptr;
 
         internalState_ |= Bad;
@@ -374,9 +373,9 @@
         // check whether a state has changed its EMPTY situation
         bool bUpdateRequired = false;
-        for (std::map<int, InputState*>::iterator it = activeStates_.begin(); it != activeStates_.end(); ++it)
-        {
-            if (it->second->hasExpired())
-            {
-                it->second->resetExpiration();
+        for (const auto& mapEntry : activeStates_)
+        {
+            if (mapEntry.second->hasExpired())
+            {
+                mapEntry.second->resetExpiration();
                 bUpdateRequired = true;
             }
@@ -387,11 +386,11 @@
         // Capture all the input and collect the function calls
         // No event gets triggered here yet!
-        BOOST_FOREACH(InputDevice* device, devices_)
-            if (device != NULL)
+        for  (InputDevice* device : devices_)
+            if (device != nullptr)
                 device->update(time);
 
         // Collect function calls for the update
-        for (unsigned int i = 0; i < activeStatesTicked_.size(); ++i)
-            activeStatesTicked_[i]->update(time.getDeltaTime());
+        for (InputState* state : activeStatesTicked_)
+            state->update(time.getDeltaTime());
 
         // Execute all cached function calls in order
@@ -402,6 +401,6 @@
         // If we delay the calls, then OIS and and the InputStates are not anymore
         // in the call stack and can therefore be edited.
-        for (size_t i = 0; i < this->callBuffer_.size(); ++i)
-            this->callBuffer_[i]();
+        for (auto& function : this->callBuffer_)
+            function();
 
         this->callBuffer_.clear();
@@ -419,5 +418,5 @@
         for (unsigned int i = 0; i < devices_.size(); ++i)
         {
-            if (devices_[i] == NULL)
+            if (devices_[i] == nullptr)
                 continue;
             std::vector<InputState*>& states = devices_[i]->getStateListRef();
@@ -438,13 +437,13 @@
         // Using an std::set to avoid duplicates
         std::set<InputState*> tempSet;
-        for (unsigned int i = 0; i < devices_.size(); ++i)
-            if (devices_[i] != NULL)
-                for (unsigned int iState = 0; iState < devices_[i]->getStateListRef().size(); ++iState)
-                    tempSet.insert(devices_[i]->getStateListRef()[iState]);
+        for (InputDevice* device : devices_)
+            if (device != nullptr)
+                for (unsigned int iState = 0; iState < device->getStateListRef().size(); ++iState)
+                    tempSet.insert(device->getStateListRef()[iState]);
 
         // Copy the content of the std::set back to the actual vector
         activeStatesTicked_.clear();
-        for (std::set<InputState*>::const_iterator it = tempSet.begin();it != tempSet.end(); ++it)
-            activeStatesTicked_.push_back(*it);
+        for (InputState* state : tempSet)
+            activeStatesTicked_.push_back(state);
 
         // Check whether we have to change the mouse mode
@@ -466,6 +465,6 @@
     void InputManager::clearBuffers()
     {
-        BOOST_FOREACH(InputDevice* device, devices_)
-            if (device != NULL)
+        for (InputDevice* device : devices_)
+            if (device != nullptr)
                 device->clearBuffers();
     }
@@ -476,6 +475,6 @@
                         << "When done, put the axex in the middle position and press enter." << endl;
 
-        BOOST_FOREACH(InputDevice* device, devices_)
-            if (device != NULL)
+        for (InputDevice* device : devices_)
+            if (device != nullptr)
                 device->startCalibration();
 
@@ -487,6 +486,6 @@
     void InputManager::stopCalibration()
     {
-        BOOST_FOREACH(InputDevice* device, devices_)
-            if (device != NULL)
+        for (InputDevice* device : devices_)
+            if (device != nullptr)
                 device->stopCalibration();
 
@@ -509,5 +508,5 @@
     {
         Mouse* mouse = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse]);
-        if (mouse != NULL)
+        if (mouse != nullptr)
         {
             const OIS::MouseState state = mouse->getOISDevice()->getMouseState();
@@ -526,5 +525,5 @@
     {
         if (name.empty())
-            return 0;
+            return nullptr;
         if (statesByName_.find(name) == statesByName_.end())
         {
@@ -532,12 +531,11 @@
             {
                 // Make sure we don't add two high priority states with the same priority
-                for (std::map<std::string, InputState*>::const_iterator it = this->statesByName_.begin();
-                    it != this->statesByName_.end(); ++it)
+                for (const auto& mapEntry : this->statesByName_)
                 {
-                    if (it->second->getPriority() == priority)
+                    if (mapEntry.second->getPriority() == priority)
                     {
                         orxout(internal_warning, context::input) << "Could not add an InputState with the same priority '"
                             << static_cast<int>(priority) << "' != 0." << endl;
-                        return 0;
+                        return nullptr;
                     }
                 }
@@ -551,5 +549,5 @@
         {
             orxout(internal_warning, context::input) << "Could not add an InputState with the same name '" << name << "'." << endl;
-            return 0;
+            return nullptr;
         }
     }
@@ -561,5 +559,5 @@
             return it->second;
         else
-            return 0;
+            return nullptr;
     }
 
