1
0
Fork 0

Performance optimization: empty() instead of size()>0

empty() is guaranteed to be constant complexity for both vectors and lists, while size() has linear complexity for lists.
This commit is contained in:
Tom Paoletti 2013-03-21 19:43:14 -07:00 committed by James Turner
parent 1f88d1d11b
commit b27eb2571c

View file

@ -893,7 +893,7 @@ void FGNasalSys::loadScriptDirectory(simgear::Dir nasalDir)
// Create module with list of scripts
void FGNasalSys::addModule(string moduleName, simgear::PathList scripts)
{
if (scripts.size()>0)
if (! scripts.empty())
{
SGPropertyNode* nasal = globals->get_props()->getNode("nasal");
SGPropertyNode* module_node = nasal->getChild(moduleName,0,true);