From 173c52a97f464fb3d0101612c6eef8a70c9a4c3e Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Thu, 29 Jan 2015 13:43:09 -0800 Subject: [PATCH] Fix build on older compilers -- emplace() is not available --- utilities/backupable/backupable_db.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/utilities/backupable/backupable_db.cc b/utilities/backupable/backupable_db.cc index f1920f110..0cac257e3 100644 --- a/utilities/backupable/backupable_db.cc +++ b/utilities/backupable/backupable_db.cc @@ -391,10 +391,10 @@ BackupEngineImpl::BackupEngineImpl(Env* db_env, continue; } assert(backups_.find(backup_id) == backups_.end()); - backups_.emplace(backup_id, - unique_ptr(new BackupMeta( - GetBackupMetaFile(backup_id), - &backuped_file_infos_, backup_env_))); + backups_.insert(std::move( + std::make_pair(backup_id, unique_ptr(new BackupMeta( + GetBackupMetaFile(backup_id), + &backuped_file_infos_, backup_env_))))); } if (options_.destroy_old_data) { // Destory old data @@ -475,10 +475,10 @@ Status BackupEngineImpl::CreateNewBackup(DB* db, bool flush_before_backup) { BackupID new_backup_id = latest_backup_id_ + 1; assert(backups_.find(new_backup_id) == backups_.end()); - auto ret = backups_.emplace(new_backup_id, - unique_ptr(new BackupMeta( - GetBackupMetaFile(new_backup_id), - &backuped_file_infos_, backup_env_))); + auto ret = backups_.insert(std::move( + std::make_pair(new_backup_id, unique_ptr(new BackupMeta( + GetBackupMetaFile(new_backup_id), + &backuped_file_infos_, backup_env_))))); assert(ret.second == true); auto& new_backup = ret.first->second; new_backup->RecordTimestamp(); @@ -1123,7 +1123,7 @@ Status BackupEngineImpl::BackupMeta::AddFile( std::shared_ptr file_info) { auto itr = file_infos_->find(file_info->filename); if (itr == file_infos_->end()) { - auto ret = file_infos_->emplace(file_info->filename, file_info); + auto ret = file_infos_->insert({file_info->filename, file_info}); if (ret.second) { itr = ret.first; itr->second->refs = 1;