db/upnp: add fallback for emplace()

The method emplace() was added in gcc 4.8.  This commit restores
compatibility with gcc 4.7.
This commit is contained in:
Max Kellermann 2014-01-13 21:35:14 +01:00
parent ca43e634b5
commit a4d580a6f8
2 changed files with 10 additions and 1 deletions

View File

@ -829,8 +829,13 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
for (auto &dirent : dirbuf.m_items) {
std::string tagvalue;
if (getTagValue(dirent, tag, tagvalue))
if (getTagValue(dirent, tag, tagvalue)) {
#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
values.emplace(std::move(tagvalue));
#else
values.insert(std::move(tagvalue));
#endif
}
}
}

View File

@ -142,7 +142,11 @@ discoExplorer(void *)
continue;
}
#if defined(__clang__) || GCC_CHECK_VERSION(4,8)
auto e = contentDirectories.m_directories.emplace(tsk->deviceId, d);
#else
auto e = contentDirectories.m_directories.insert(std::make_pair(tsk->deviceId, d));
#endif
if (!e.second)
e.first->second = d;
}