← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2874: throw some range-based for loops :)

 

------------------------------------------------------------
revno: 2874
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2012-03-03 16:19:48 +0100
message:
  throw some range-based for loops :)
modified:
  dcpp/MappingManager.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/MappingManager.cpp'
--- dcpp/MappingManager.cpp	2012-03-03 15:04:23 +0000
+++ dcpp/MappingManager.cpp	2012-03-03 15:19:48 +0000
@@ -42,8 +42,8 @@
 
 StringList MappingManager::getMappers() const {
 	StringList ret;
-	for(auto i = mappers.cbegin(), iend = mappers.cend(); i != iend; ++i)
-		ret.push_back(i->first);
+	for(auto& i: mappers)
+		ret.push_back(i.first);
 	return ret;
 }
 
@@ -141,8 +141,8 @@
 		}
 	}
 
-	for(auto i = mappers.begin(); i != mappers.end(); ++i) {
-		unique_ptr<Mapper> pMapper(i->second(Util::getLocalIp()));
+	for(auto& i: mappers) {
+		unique_ptr<Mapper> pMapper(i.second(Util::getLocalIp()));
 		Mapper& mapper = *pMapper;
 
 		ScopedFunctor([&mapper] { mapper.uninit(); });