[Orxonox-commit 6261] r10918 - in code/branches/cpp11_v2/src: libraries/core libraries/core/class libraries/core/command libraries/core/config libraries/core/input libraries/network libraries/network/packet libraries/tools libraries/util libraries/util/output modules/designtools modules/objects/triggers modules/pong orxonox/sound

muemart at orxonox.net muemart at orxonox.net
Sat Dec 5 19:10:58 CET 2015


Author: muemart
Date: 2015-12-05 19:10:56 +0100 (Sat, 05 Dec 2015)
New Revision: 10918

Modified:
   code/branches/cpp11_v2/src/libraries/core/ConfigurablePaths.cc
   code/branches/cpp11_v2/src/libraries/core/Game.cc
   code/branches/cpp11_v2/src/libraries/core/LuaState.cc
   code/branches/cpp11_v2/src/libraries/core/LuaState.h
   code/branches/cpp11_v2/src/libraries/core/class/Identifier.h
   code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc
   code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.h
   code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc
   code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.cc
   code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.h
   code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc
   code/branches/cpp11_v2/src/libraries/network/FunctionCall.cc
   code/branches/cpp11_v2/src/libraries/network/FunctionCallManager.cc
   code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.cc
   code/branches/cpp11_v2/src/libraries/tools/DebugDrawer.cc
   code/branches/cpp11_v2/src/libraries/tools/DynamicLines.cc
   code/branches/cpp11_v2/src/libraries/tools/IcoSphere.cc
   code/branches/cpp11_v2/src/libraries/util/SubString.cc
   code/branches/cpp11_v2/src/libraries/util/output/BaseWriter.cc
   code/branches/cpp11_v2/src/libraries/util/output/MemoryWriter.cc
   code/branches/cpp11_v2/src/modules/designtools/SkyboxGenerator.cc
   code/branches/cpp11_v2/src/modules/objects/triggers/MultiTrigger.cc
   code/branches/cpp11_v2/src/modules/pong/PongAI.cc
   code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc
   code/branches/cpp11_v2/src/orxonox/sound/WorldAmbientSound.cc
Log:
Use emplace_back instead of push_back if beneficial

Modified: code/branches/cpp11_v2/src/libraries/core/ConfigurablePaths.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/ConfigurablePaths.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/ConfigurablePaths.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -144,8 +144,8 @@
 
         // Create directories to avoid problems when opening files in non existent folders.
         std::vector<std::pair<bf::path, std::string>> directories;
-        directories.push_back(std::make_pair(bf::path(configPath_), std::string("config")));
-        directories.push_back(std::make_pair(bf::path(logPath_), std::string("log")));
+        directories.emplace_back(bf::path(configPath_), std::string("config"));
+        directories.emplace_back(bf::path(logPath_), std::string("log"));
 
         for (std::vector<std::pair<bf::path, std::string>>::iterator it = directories.begin();
             it != directories.end(); ++it)

Modified: code/branches/cpp11_v2/src/libraries/core/Game.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/Game.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/Game.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -463,12 +463,12 @@
             startPos = pos;
             while (pos < str.size() && str[pos] != ' ')
                 ++pos;
-            stateStrings.push_back(std::make_pair(str.substr(startPos, pos - startPos), indentation));
+            stateStrings.emplace_back(str.substr(startPos, pos - startPos), indentation);
         }
         if (stateStrings.empty())
             ThrowException(GameState, "Emtpy GameState hierarchy provided, terminating.");
         // Add element with large identation to detect the last with just an iterator
-        stateStrings.push_back(std::make_pair(std::string(), -1));
+        stateStrings.emplace_back(std::string(), -1);
 
         // Parse elements recursively
         std::vector<std::pair<std::string, int>>::const_iterator begin = stateStrings.begin();

Modified: code/branches/cpp11_v2/src/libraries/core/LuaState.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/LuaState.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/LuaState.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -258,9 +258,9 @@
             for (size_t i = 1; i <= newlinecount; i++)
             {
                 //Add the new line to the trace map
-                lineTrace_->push_back(std::vector<std::pair<std::string, size_t>>());
+                lineTrace_->emplace_back();
                 //Add the source of the line at the end
-                lineTrace_->rbegin()->push_back(std::make_pair(filename, line + i));
+                lineTrace_->rbegin()->emplace_back(filename, line + i);
             }
         }
 

Modified: code/branches/cpp11_v2/src/libraries/core/LuaState.h
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/LuaState.h	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/LuaState.h	2015-12-05 18:10:56 UTC (rev 10918)
@@ -94,7 +94,7 @@
         void clearOutput() { output_.clear(); } // tolua_export
 
         void setTraceMap(std::shared_ptr<std::vector<std::vector<std::pair<std::string, size_t>>>> map)
-            { map->push_back(std::vector<std::pair<std::string, size_t>>()); lineTrace_ = map; }
+            { map->emplace_back(); lineTrace_ = map; }
 
         void setIncludeParser(std::string (*function)(const std::string&)) { includeParseFunction_ = function; }
         lua_State* getInternalLuaState() { return luaState_; }

Modified: code/branches/cpp11_v2/src/libraries/core/class/Identifier.h
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/class/Identifier.h	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/class/Identifier.h	2015-12-05 18:10:56 UTC (rev 10918)
@@ -362,7 +362,7 @@
             this->addObjectToList(object, object);
 
             // Add pointer of type T to the map in the Identifiable instance that enables "dynamic_casts"
-            object->objectPointers_.push_back(std::make_pair(this->getClassID(), static_cast<void*>(object)));
+            object->objectPointers_.emplace_back(this->getClassID(), static_cast<void*>(object));
             return false;
         }
     }

Modified: code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -101,7 +101,7 @@
                 const std::map<std::string, std::map<std::string, ConsoleCommand*>>& commands = ConsoleCommandManager::getInstance().getCommands();
                 for (const auto& mapEntry : commands)
                     if (groupIsVisible(mapEntry.second, bOnlyShowHidden) && mapEntry.first != "" && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0))
-                        groupList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first)));
+                        groupList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
 
                 // now add all shortcuts (in group "")
                 std::map<std::string, std::map<std::string, ConsoleCommand*>>::const_iterator it_group = commands.find("");
@@ -109,12 +109,12 @@
                 {
                     // add a line-break if the list isn't empty
                     if (!groupList.empty())
-                        groupList.push_back(ArgumentCompletionListElement("", "", "\n"));
+                        groupList.emplace_back("", "", "\n");
 
                     // add the shortcuts
                     for (const auto& mapEntry : it_group->second)
                         if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden && (fragmentLC == "" || getLowercase(mapEntry.first).find(fragmentLC) == 0))
-                            groupList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first)));
+                            groupList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
                 }
 
                 // if no shortcut was added, remove the line-break again
@@ -147,7 +147,7 @@
                 {
                     for (const auto& mapEntry : it_group->second)
                         if (mapEntry.second->isActive() && mapEntry.second->hasAccess() && (!mapEntry.second->isHidden())^bOnlyShowHidden)
-                            commandList.push_back(ArgumentCompletionListElement(mapEntry.first, getLowercase(mapEntry.first)));
+                            commandList.emplace_back(mapEntry.first, getLowercase(mapEntry.first));
                 }
 
                 return commandList;
@@ -187,7 +187,7 @@
             else
             {
                 ArgumentCompletionList list;
-                list.push_back(ArgumentCompletionListElement("", "", hint));
+                list.emplace_back("", "", hint);
                 return list;
             }
         }
@@ -260,9 +260,9 @@
                 while (file != end)
                 {
                     if (boost::filesystem::is_directory(*file))
-                        dirlist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/'));
+                        dirlist.emplace_back(file->BF_DICTIONARY_ENTRY_NAME() + '/', getLowercase(file->BF_DICTIONARY_ENTRY_NAME()) + '/', file->BF_LEAF() + '/');
                     else
-                        filelist.push_back(ArgumentCompletionListElement(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF()));
+                        filelist.emplace_back(file->BF_DICTIONARY_ENTRY_NAME(), getLowercase(file->BF_DICTIONARY_ENTRY_NAME()), file->BF_LEAF());
                     ++file;
                 }
             }
@@ -281,7 +281,7 @@
 
             const std::set<std::string>& names = SettingsConfigFile::getInstance().getSectionNames();
             for (const std::string& name : names)
-                sectionList.push_back(ArgumentCompletionListElement(name, getLowercase(name)));
+                sectionList.emplace_back(name, getLowercase(name));
 
             return sectionList;
         }
@@ -297,7 +297,7 @@
 
             SettingsConfigFile::ContainerMap::const_iterator upper = settings.getContainerUpperBound(sectionLC);
             for (SettingsConfigFile::ContainerMap::const_iterator it = settings.getContainerLowerBound(sectionLC); it != upper; ++it)
-                entryList.push_back(ArgumentCompletionListElement(it->second.second->getName(), it->second.first));
+                entryList.emplace_back(it->second.second->getName(), it->second.first);
 
             return entryList;
         }
@@ -318,7 +318,7 @@
                 if (it->second.first == entryLC)
                 {
                     const std::string& valuestring = it->second.second->toString();
-                    oldValue.push_back(ArgumentCompletionListElement(valuestring, getLowercase(valuestring), "Old value: " + valuestring));
+                    oldValue.emplace_back(valuestring, getLowercase(valuestring), "Old value: " + valuestring);
                 }
             }
 
@@ -334,7 +334,7 @@
             ArgumentCompletionList threads;
 
             for (std::list<unsigned int>::const_iterator it = threadnumbers.begin(); it != threadnumbers.end(); ++it)
-                threads.push_back(ArgumentCompletionListElement(multi_cast<std::string>(*it)));
+                threads.emplace_back(multi_cast<std::string>(*it));
 
             return threads;
         }

Modified: code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.h
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.h	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/command/ArgumentCompletionFunctions.h	2015-12-05 18:10:56 UTC (rev 10918)
@@ -85,22 +85,22 @@
         if (isNumber(fragment))
         {
             for (int month = 1; month <= 12; ++month)
-                list.push_back(ArgumentCompletionListElement(multi_cast<std::string>(month)));
+                list.emplace_back(multi_cast<std::string>(month));
         }
         else
         {
-            list.push_back(ArgumentCompletionListElement("January",   "january"));
-            list.push_back(ArgumentCompletionListElement("February",  "february"));
-            list.push_back(ArgumentCompletionListElement("March",     "march"));
-            list.push_back(ArgumentCompletionListElement("April",     "april"));
-            list.push_back(ArgumentCompletionListElement("May",       "may"));
-            list.push_back(ArgumentCompletionListElement("June",      "june"));
-            list.push_back(ArgumentCompletionListElement("July",      "july"));
-            list.push_back(ArgumentCompletionListElement("August",    "august"));
-            list.push_back(ArgumentCompletionListElement("September", "september"));
-            list.push_back(ArgumentCompletionListElement("October",   "october"));
-            list.push_back(ArgumentCompletionListElement("November",  "november"));
-            list.push_back(ArgumentCompletionListElement("December",  "december"));
+            list.emplace_back("January",   "january");
+            list.emplace_back("February",  "february");
+            list.emplace_back("March",     "march");
+            list.emplace_back("April",     "april");
+            list.emplace_back("May",       "may");
+            list.emplace_back("June",      "june");
+            list.emplace_back("July",      "july");
+            list.emplace_back("August",    "august");
+            list.emplace_back("September", "september");
+            list.emplace_back("October",   "october");
+            list.emplace_back("November",  "november");
+            list.emplace_back("December",  "december");
         }
 
         return list;

Modified: code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/command/ConsoleCommand.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -83,7 +83,7 @@
         if (bInitialized)
             this->executor_ = executor;
 
-        this->names_.push_back(CommandName(group, name));
+        this->names_.emplace_back(group, name);
     }
 
     /**
@@ -98,7 +98,7 @@
     */
     ConsoleCommand& ConsoleCommand::addShortcut()
     {
-        this->names_.push_back(CommandName("", this->baseName_));
+        this->names_.emplace_back("", this->baseName_);
         return *this;
     }
 
@@ -107,7 +107,7 @@
     */
     ConsoleCommand& ConsoleCommand::addShortcut(const std::string&  name)
     {
-        this->names_.push_back(CommandName("", name));
+        this->names_.emplace_back("", name);
         return *this;
     }
 
@@ -116,7 +116,7 @@
     */
     ConsoleCommand& ConsoleCommand::addGroup(const std::string& group)
     {
-        this->names_.push_back(CommandName(group, this->baseName_));
+        this->names_.emplace_back(group, this->baseName_);
         return *this;
     }
 
@@ -125,7 +125,7 @@
     */
     ConsoleCommand& ConsoleCommand::addGroup(const std::string& group, const std::string&  name)
     {
-        this->names_.push_back(CommandName(group, name));
+        this->names_.emplace_back(group, name);
         return *this;
     }
 

Modified: code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -190,7 +190,7 @@
             {
                 for (unsigned int i = this->valueVector_.size(); i <= index; i++)
                 {
-                    this->valueVector_.push_back(MultiType());
+                    this->valueVector_.emplace_back();
                 }
             }
 

Modified: code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.h
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.h	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/config/ConfigValueContainer.h	2015-12-05 18:10:56 UTC (rev 10918)
@@ -130,7 +130,7 @@
 
                 this->value_ = V();
                 for (const D& defvalueElement : defvalue)
-                    this->valueVector_.push_back(MultiType(defvalueElement));
+                    this->valueVector_.emplace_back(defvalueElement);
 
                 this->initVector();
             }

Modified: code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/core/input/KeyBinder.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -187,9 +187,9 @@
     void KeyBinder::initialiseJoyStickBindings()
     {
         while (joyStickAxes_.size() < joySticks_.size())
-            joyStickAxes_.push_back(std::shared_ptr<JoyStickAxisVector>(std::make_shared<JoyStickAxisVector>()));
+            joyStickAxes_.push_back(std::make_shared<JoyStickAxisVector>());
         while (joyStickButtons_.size() < joySticks_.size())
-            joyStickButtons_.push_back(std::shared_ptr<JoyStickButtonVector>(std::make_shared<JoyStickButtonVector>()));
+            joyStickButtons_.push_back(std::make_shared<JoyStickButtonVector>());
         // For the case the new size is smaller
         this->joyStickAxes_.resize(joySticks_.size());
         this->joyStickButtons_.resize(joySticks_.size());

Modified: code/branches/cpp11_v2/src/libraries/network/FunctionCall.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/network/FunctionCall.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/network/FunctionCall.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -118,7 +118,7 @@
   mem += 3*sizeof(uint32_t);
   for( unsigned int i=0; i<this->nrOfArguments_; ++i )
   {
-    this->arguments_.push_back(MultiType());
+    this->arguments_.emplace_back();
     this->arguments_.back().importData(mem);
   }
 }

Modified: code/branches/cpp11_v2/src/libraries/network/FunctionCallManager.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/network/FunctionCallManager.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/network/FunctionCallManager.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -64,7 +64,7 @@
 
 void FunctionCallManager::bufferIncomingFunctionCall(const orxonox::FunctionCall& fctCall, uint32_t minGamestateID, uint32_t peerID)
 {
-  FunctionCallManager::sIncomingFunctionCallBuffer_.push_back( std::make_pair(fctCall, std::make_pair(minGamestateID, peerID)));
+  FunctionCallManager::sIncomingFunctionCallBuffer_.emplace_back(fctCall, std::make_pair(minGamestateID, peerID));
 }
 
 void FunctionCallManager::processBufferedFunctionCalls()

Modified: code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -132,7 +132,7 @@
 
     tempsize = it->getData(mem, this->sizes_, id, mode);
     if ( tempsize != 0 )
-      dataVector_.push_back( obj(it->getObjectID(), it->getContextID(), tempsize, mem-data_) );
+      dataVector_.emplace_back(it->getObjectID(), it->getContextID(), tempsize, mem-data_);
 
 #ifndef NDEBUG
     if(currentsize+tempsize > size)

Modified: code/branches/cpp11_v2/src/libraries/tools/DebugDrawer.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/tools/DebugDrawer.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/tools/DebugDrawer.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -432,7 +432,7 @@
 
     int DebugDrawer::addLineVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour)
     {
-        lineVertices.push_back(VertexPair(vertex, colour));
+        lineVertices.emplace_back(vertex, colour);
         return linesIndex++;
     }
 
@@ -444,7 +444,7 @@
 
     int DebugDrawer::addTriangleVertex(const Ogre::Vector3& vertex, const Ogre::ColourValue& colour)
     {
-        triangleVertices.push_back(VertexPair(vertex, colour));
+        triangleVertices.emplace_back(vertex, colour);
         return trianglesIndex++;
     }
 

Modified: code/branches/cpp11_v2/src/libraries/tools/DynamicLines.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/tools/DynamicLines.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/tools/DynamicLines.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -68,7 +68,7 @@
 
     void DynamicLines::addPoint(Real x, Real y, Real z)
     {
-        mPoints.push_back(Vector3(x,y,z));
+        mPoints.emplace_back(x,y,z);
         mDirty = true;
     }
 

Modified: code/branches/cpp11_v2/src/libraries/tools/IcoSphere.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/tools/IcoSphere.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/tools/IcoSphere.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -125,10 +125,10 @@
                 removeLineIndices(f.v2, f.v3);
                 removeLineIndices(f.v3, f.v1);
 
-                faces2.push_back(TriangleIndices(f.v1, a, c));
-                faces2.push_back(TriangleIndices(f.v2, b, a));
-                faces2.push_back(TriangleIndices(f.v3, c, b));
-                faces2.push_back(TriangleIndices(a, b, c));
+                faces2.emplace_back(f.v1, a, c);
+                faces2.emplace_back(f.v2, b, a);
+                faces2.emplace_back(f.v3, c, b);
+                faces2.emplace_back(a, b, c);
 
                 addTriangleLines(f.v1, a, c);
                 addTriangleLines(f.v2, b, a);
@@ -141,7 +141,7 @@
 
     void IcoSphere::addLineIndices(int index0, int index1)
     {
-        lineIndices.push_back(LineIndices(index0, index1));
+        lineIndices.emplace_back(index0, index1);
     }
 
     void IcoSphere::removeLineIndices(int index0, int index1)
@@ -162,7 +162,7 @@
     int IcoSphere::addVertex(const Ogre::Vector3& vertex)
     {
         Ogre::Real length = vertex.length();
-        vertices.push_back(Ogre::Vector3(vertex.x / length, vertex.y / length, vertex.z / length));
+        vertices.emplace_back(vertex.x / length, vertex.y / length, vertex.z / length);
         return index++;
     }
 
@@ -187,7 +187,7 @@
 
     void IcoSphere::addFace(int index0, int index1, int index2)
     {
-        faces.push_back(TriangleIndices(index0, index1, index2));
+        faces.emplace_back(index0, index1, index2);
     }
 
     void IcoSphere::addToLineIndices(int baseIndex, std::list<int>* target) const
@@ -216,7 +216,7 @@
         transform.setScale(Ogre::Vector3(scale, scale, scale));
 
         for (const Ogre::Vector3& vertex : vertices)
-            target->push_back(VertexPair(transform * vertex, colour));
+            target->emplace_back(transform * vertex, colour);
 
         return vertices.size();
     }

Modified: code/branches/cpp11_v2/src/libraries/util/SubString.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/util/SubString.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/util/SubString.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -111,7 +111,7 @@
     {
         for (size_t i = 0; i < argc; ++i)
         {
-            this->tokens_.push_back(std::string(argv[i]));
+            this->tokens_.emplace_back(argv[i]);
             this->bTokenInSafemode_.push_back(false);
         }
     }

Modified: code/branches/cpp11_v2/src/libraries/util/output/BaseWriter.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/util/output/BaseWriter.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/util/output/BaseWriter.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -46,7 +46,7 @@
 
         this->configurableMaxLevel_ = level::none;
         this->configurableAdditionalContextsMaxLevel_ = level::verbose;
-        this->configurableAdditionalContexts_.push_back("example");
+        this->configurableAdditionalContexts_.emplace_back("example");
 
         this->changedConfigurableLevel();
         this->changedConfigurableAdditionalContextsLevel();

Modified: code/branches/cpp11_v2/src/libraries/util/output/MemoryWriter.cc
===================================================================
--- code/branches/cpp11_v2/src/libraries/util/output/MemoryWriter.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/libraries/util/output/MemoryWriter.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -56,7 +56,7 @@
     */
     void MemoryWriter::output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
     {
-        this->messages_.push_back(Message(level, context, lines));
+        this->messages_.emplace_back(level, context, lines);
     }
 
     /**

Modified: code/branches/cpp11_v2/src/modules/designtools/SkyboxGenerator.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/designtools/SkyboxGenerator.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/modules/designtools/SkyboxGenerator.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -81,19 +81,19 @@
         this->bCleanup_ = true;
         this->faceCounter_ = 0;
         
-        this->names_.push_back("fr");
-        this->names_.push_back("lf");
-        this->names_.push_back("bk");
-        this->names_.push_back("rt");
-        this->names_.push_back("up");
-        this->names_.push_back("dn");
+        this->names_.emplace_back("fr");
+        this->names_.emplace_back("lf");
+        this->names_.emplace_back("bk");
+        this->names_.emplace_back("rt");
+        this->names_.emplace_back("up");
+        this->names_.emplace_back("dn");
         
-        this->rotations_.push_back(std::pair<int, int>(90, 0));
-        this->rotations_.push_back(std::pair<int, int>(90, 0));
-        this->rotations_.push_back(std::pair<int, int>(90, 0));
-        this->rotations_.push_back(std::pair<int, int>(90, 90));
-        this->rotations_.push_back(std::pair<int, int>(0, 180));
-        this->rotations_.push_back(std::pair<int, int>(0, 90));
+        this->rotations_.emplace_back(90, 0);
+        this->rotations_.emplace_back(90, 0);
+        this->rotations_.emplace_back(90, 0);
+        this->rotations_.emplace_back(90, 90);
+        this->rotations_.emplace_back(0, 180);
+        this->rotations_.emplace_back(0, 90);
     }
 
     /**

Modified: code/branches/cpp11_v2/src/modules/objects/triggers/MultiTrigger.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/objects/triggers/MultiTrigger.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/modules/objects/triggers/MultiTrigger.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -264,7 +264,7 @@
                 // If the remaining time has not yet expired. Decrement the remainig time and put the state at the end of the queue.
                 else
                 {
-                    this->stateQueue_.push_back(std::pair<float, MultiTriggerState*>(timeRemaining-dt, state));
+                    this->stateQueue_.emplace_back(timeRemaining-dt, state);
                     this->stateQueue_.pop_front();
                 }
             }
@@ -488,7 +488,7 @@
         }
 
         // Add it ot the state queue with the delay specified for the MultiTrigger.
-        this->stateQueue_.push_back(std::pair<float, MultiTriggerState*>(this->getDelay(), state));
+        this->stateQueue_.emplace_back(this->getDelay(), state);
 
         return true;
     }

Modified: code/branches/cpp11_v2/src/modules/pong/PongAI.cc
===================================================================
--- code/branches/cpp11_v2/src/modules/pong/PongAI.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/modules/pong/PongAI.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -361,7 +361,7 @@
 
             // Add a new Timer
             Timer* timer = new Timer(delay, false, createExecutor(createFunctor(&PongAI::delayedMove, this)));
-            this->reactionTimers_.push_back(std::pair<Timer*, char>(timer, direction));
+            this->reactionTimers_.emplace_back(timer, direction);
         }
         else
         {

Modified: code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/orxonox/sound/SoundManager.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -575,7 +575,7 @@
         {
             ALuint source = this->availableSoundSources_.back();
             this->availableSoundSources_.pop_back();
-            this->usedSoundSources_.push_back(std::make_pair(source, object));
+            this->usedSoundSources_.emplace_back(source, object);
             return source;
         }
         else
@@ -587,7 +587,7 @@
                 // Try to create new sources (50% more, but at least one)
                 if (alIsSource(source) && !alGetError())
                 {
-                    this->usedSoundSources_.push_back(std::make_pair(source, object));
+                    this->usedSoundSources_.emplace_back(source, object);
                     return source;
                 }
             }

Modified: code/branches/cpp11_v2/src/orxonox/sound/WorldAmbientSound.cc
===================================================================
--- code/branches/cpp11_v2/src/orxonox/sound/WorldAmbientSound.cc	2015-12-02 22:32:08 UTC (rev 10917)
+++ code/branches/cpp11_v2/src/orxonox/sound/WorldAmbientSound.cc	2015-12-05 18:10:56 UTC (rev 10918)
@@ -48,15 +48,15 @@
 
         this->ambientSound_ = new AmbientSound();
         this->registerVariables();
-        soundList_.push_back("Earth.ogg");
-        soundList_.push_back("Jupiter.ogg");
-        soundList_.push_back("Mars.ogg");
-        soundList_.push_back("allgorythm-lift_up.ogg");
-        soundList_.push_back("allgorythm-resonance_blaster.ogg");
-        soundList_.push_back("AlphaCentauri.ogg");
-        soundList_.push_back("Asteroid_rocks.ogg");
-        soundList_.push_back("Ganymede.ogg");
-        soundList_.push_back("luke_grey_-_hypermode.ogg");
+        soundList_.emplace_back("Earth.ogg");
+        soundList_.emplace_back("Jupiter.ogg");
+        soundList_.emplace_back("Mars.ogg");
+        soundList_.emplace_back("allgorythm-lift_up.ogg");
+        soundList_.emplace_back("allgorythm-resonance_blaster.ogg");
+        soundList_.emplace_back("AlphaCentauri.ogg");
+        soundList_.emplace_back("Asteroid_rocks.ogg");
+        soundList_.emplace_back("Ganymede.ogg");
+        soundList_.emplace_back("luke_grey_-_hypermode.ogg");
 
     }
     WorldAmbientSound::~WorldAmbientSound()




More information about the Orxonox-commit mailing list