Fix build on older compilers -- emplace() is not available

This commit is contained in:
Igor Canadi 2015-01-29 13:43:09 -08:00
parent d07fec3bdc
commit 173c52a97f

View File

@ -391,10 +391,10 @@ BackupEngineImpl::BackupEngineImpl(Env* db_env,
continue; continue;
} }
assert(backups_.find(backup_id) == backups_.end()); assert(backups_.find(backup_id) == backups_.end());
backups_.emplace(backup_id, backups_.insert(std::move(
unique_ptr<BackupMeta>(new BackupMeta( std::make_pair(backup_id, unique_ptr<BackupMeta>(new BackupMeta(
GetBackupMetaFile(backup_id), GetBackupMetaFile(backup_id),
&backuped_file_infos_, backup_env_))); &backuped_file_infos_, backup_env_)))));
} }
if (options_.destroy_old_data) { // Destory old data 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; BackupID new_backup_id = latest_backup_id_ + 1;
assert(backups_.find(new_backup_id) == backups_.end()); assert(backups_.find(new_backup_id) == backups_.end());
auto ret = backups_.emplace(new_backup_id, auto ret = backups_.insert(std::move(
unique_ptr<BackupMeta>(new BackupMeta( std::make_pair(new_backup_id, unique_ptr<BackupMeta>(new BackupMeta(
GetBackupMetaFile(new_backup_id), GetBackupMetaFile(new_backup_id),
&backuped_file_infos_, backup_env_))); &backuped_file_infos_, backup_env_)))));
assert(ret.second == true); assert(ret.second == true);
auto& new_backup = ret.first->second; auto& new_backup = ret.first->second;
new_backup->RecordTimestamp(); new_backup->RecordTimestamp();
@ -1123,7 +1123,7 @@ Status BackupEngineImpl::BackupMeta::AddFile(
std::shared_ptr<FileInfo> file_info) { std::shared_ptr<FileInfo> file_info) {
auto itr = file_infos_->find(file_info->filename); auto itr = file_infos_->find(file_info->filename);
if (itr == file_infos_->end()) { 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) { if (ret.second) {
itr = ret.first; itr = ret.first;
itr->second->refs = 1; itr->second->refs = 1;