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:
parent
5182dc6cc9
commit
68c0f8a310
|
@ -260,7 +260,12 @@ public:
|
||||||
return &ent;
|
return &ent;
|
||||||
}
|
}
|
||||||
FileEntry *cache_fd(const std::string &path, const FileEntry &ent) {
|
FileEntry *cache_fd(const std::string &path, const FileEntry &ent) {
|
||||||
|
#ifdef HAVE_STD_MAP_EMPLACE
|
||||||
auto rv = fd_cache_.emplace(path, ent);
|
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;
|
return &(*rv.first).second;
|
||||||
}
|
}
|
||||||
void release_fd(const std::string &path) {
|
void release_fd(const std::string &path) {
|
||||||
|
|
|
@ -64,7 +64,8 @@ DownstreamQueue::find_host_entry(const std::string &host) {
|
||||||
std::tie(itr, std::ignore) = host_entries_.emplace(host, HostEntry());
|
std::tie(itr, std::ignore) = host_entries_.emplace(host, HostEntry());
|
||||||
#else // !HAVE_STD_MAP_EMPLACE
|
#else // !HAVE_STD_MAP_EMPLACE
|
||||||
// for g++-4.7
|
// 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
|
#endif // !HAVE_STD_MAP_EMPLACE
|
||||||
}
|
}
|
||||||
return (*itr).second;
|
return (*itr).second;
|
||||||
|
|
Loading…
Reference in New Issue