Fix compile error with gcc-4.7

Use std::map::insert instead of std::map::emplace, since gcc-4.7 does
not support the latter.
This commit is contained in:
Tatsuhiro Tsujikawa 2015-06-27 11:19:10 +09:00
parent 5182dc6cc9
commit 68c0f8a310
2 changed files with 7 additions and 1 deletions

View File

@ -260,7 +260,12 @@ public:
return &ent;
}
FileEntry *cache_fd(const std::string &path, const FileEntry &ent) {
#ifdef HAVE_STD_MAP_EMPLACE
auto rv = fd_cache_.emplace(path, ent);
#else // !HAVE_STD_MAP_EMPLACE
// for gcc-4.7
auto rv = fd_cache_.insert(std::make_pair(path, ent));
#endif // !HAVE_STD_MAP_EMPLACE
return &(*rv.first).second;
}
void release_fd(const std::string &path) {

View File

@ -64,7 +64,8 @@ DownstreamQueue::find_host_entry(const std::string &host) {
std::tie(itr, std::ignore) = host_entries_.emplace(host, HostEntry());
#else // !HAVE_STD_MAP_EMPLACE
// for g++-4.7
std::tie(itr, std::ignore) = host_entries_.insert({host, HostEntry()});
std::tie(itr, std::ignore) =
host_entries_.insert(std::make_pair(host, HostEntry()));
#endif // !HAVE_STD_MAP_EMPLACE
}
return (*itr).second;