Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CPPLint issues in tuple.h #9670

Merged
merged 3 commits into from
Apr 6, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions paddle/fluid/framework/tuple.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,25 @@ class Tuple {
public:
using ElementVars = std::vector<ElementVar>;

Tuple(std::vector<ElementVar>& var, std::vector<VarDesc>& var_desc)
Tuple(const std::vector<ElementVar>& var,
const std::vector<VarDesc>& var_desc)
: var_(var), var_desc_(var_desc) {}
Tuple(std::vector<ElementVar>& var) : var_(var) {}
explicit Tuple(std::vector<ElementVar>& var) : var_(var) {}

ElementVar get(int idx) const { return var_[idx]; };
ElementVar get(int idx) const { return var_[idx]; }

ElementVar& get(int idx) { return var_[idx]; };
ElementVar& get(int idx) { return var_[idx]; }

bool isSameType(Tuple& t) const;
bool isSameType(const Tuple& t) const;

size_t getSize() const { return var_.size(); };
size_t getSize() const { return var_.size(); }

private:
ElementVars var_;
std::vector<VarDesc> var_desc_;
};

bool Tuple::isSameType(Tuple& t) const {
bool Tuple::isSameType(const Tuple& t) const {
size_t tuple_size = getSize();
if (tuple_size != t.getSize()) {
return false;
Expand Down