提交 69642000 编写于 作者: M minqiyang

Hide KeyHasher

test=develop
上级 27a0d6c2
...@@ -38,14 +38,6 @@ bool IsFastEagerDeletionModeEnabled(); ...@@ -38,14 +38,6 @@ bool IsFastEagerDeletionModeEnabled();
class Scope; class Scope;
namespace inner {
struct KeyHasher {
std::size_t operator()(const std::string& key) const {
return XXH32(key.c_str(), key.size(), 1);
}
};
} // namespace inner
/** /**
* @brief Scope that manage all variables. * @brief Scope that manage all variables.
* *
...@@ -110,8 +102,13 @@ class Scope { ...@@ -110,8 +102,13 @@ class Scope {
std::string Rename(const std::string& origin_name) const; std::string Rename(const std::string& origin_name) const;
protected: protected:
mutable std::unordered_map<std::string, std::unique_ptr<Variable>, struct KeyHasher {
inner::KeyHasher> std::size_t operator()(const std::string& key) const {
return XXH32(key.c_str(), key.size(), 1);
}
};
mutable std::unordered_map<std::string, std::unique_ptr<Variable>, KeyHasher>
vars_; vars_;
private: private:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册