No need for manual copy. Implemented exception safe copy
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 31 Jan 2011 10:56:58 +0000 (11:56 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 31 Jan 2011 10:56:58 +0000 (11:56 +0100)
src/service.cpp

index 58c84cb..57071fb 100644 (file)
@@ -146,11 +146,8 @@ Logger::Ptr Service::get_logger() const
  */
 void Service::set_last_updates(std::map<time_t,std::string> _last_updates)
 {
-    LastUpdates.clear();
-    for ( std::map<time_t,std::string>::iterator iter = _last_updates.begin(); iter != _last_updates.end(); iter++ )
-    {
-        LastUpdates.insert(make_pair(iter->first,iter->second));
-    }
+    std::map<time_t,std::string> temp = _last_updates;
+    LastUpdates.swap(temp);
 }