提交 eab0e522 编写于 作者: Y Yu Yang

To google code style

上级 32fe0976
...@@ -61,7 +61,7 @@ Just like [scope](https://en.wikipedia.org/wiki/Scope_(computer_science)) in pro ...@@ -61,7 +61,7 @@ Just like [scope](https://en.wikipedia.org/wiki/Scope_(computer_science)) in pro
```cpp ```cpp
class Scope { class Scope {
public: public:
Scope(const std::shared_ptr<Scope>& scope): parent_(scope) {} Scope(const std::shared_ptr<Scope>& scope): parent_(scope) {}
Variable* GetVar(const std::string& name) const { Variable* GetVar(const std::string& name) const {
...@@ -75,7 +75,7 @@ public: ...@@ -75,7 +75,7 @@ public:
} }
} }
private: private:
std::shared_ptr<Scope> parent_ {nullptr}; std::shared_ptr<Scope> parent_ {nullptr};
}; };
``` ```
...@@ -88,16 +88,16 @@ A local scope is very useful when we implement Recurrent Neural Network. Each ti ...@@ -88,16 +88,16 @@ A local scope is very useful when we implement Recurrent Neural Network. Each ti
```cpp ```cpp
class Variable { class Variable {
private: private:
Variable() = default; Variable() = default;
friend class Scope; friend class Scope;
}; };
class Scope { class Scope {
private: private:
Scope(const std::shared_ptr<Scope>& parent = nullptr); Scope(const std::shared_ptr<Scope>& parent = nullptr);
public: public:
static std::shared_ptr<Scope> Create(const std::shared_ptr<Scope>& parent = nullptr); static std::shared_ptr<Scope> Create(const std::shared_ptr<Scope>& parent = nullptr);
// return nullptr if not found. // return nullptr if not found.
...@@ -106,7 +106,7 @@ public: ...@@ -106,7 +106,7 @@ public:
// return Error if already contains same name variable. // return Error if already contains same name variable.
Error CreateVariable(const std::string& name); Error CreateVariable(const std::string& name);
private: private:
std::shared_ptr<Scope> parent_; std::shared_ptr<Scope> parent_;
std::unordered_map<std::string, std::unique_ptr<Scope>> attrs_; std::unordered_map<std::string, std::unique_ptr<Scope>> attrs_;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册