From d4a8967c1e2b50a7dda517427ac0d2aa5dd5f8ef Mon Sep 17 00:00:00 2001 From: tangwei12 Date: Thu, 25 Oct 2018 16:10:10 +0800 Subject: [PATCH] add const in &, test=develop --- paddle/fluid/framework/attribute.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/framework/attribute.h b/paddle/fluid/framework/attribute.h index d9c76881b7..f3ad88626f 100644 --- a/paddle/fluid/framework/attribute.h +++ b/paddle/fluid/framework/attribute.h @@ -193,7 +193,7 @@ class DefaultValueSetter { public: explicit DefaultValueSetter(T default_value) : default_value_(default_value) {} - void operator()(T& value) const { value = default_value_; } // NOLINT + void operator()(const T& value) const { value = default_value_; } private: T default_value_; @@ -268,7 +268,7 @@ class TypedAttrChecker { return *this; } - void operator()(AttributeMap& attr_map) const { // NOLINT + void operator()(const AttributeMap& attr_map) const { if (!attr_map.count(attr_name_)) { // user do not set this attr PADDLE_ENFORCE(!default_value_setter_.empty(), @@ -294,7 +294,7 @@ class TypedAttrChecker { // check whether op's all attributes fit their own limits class OpAttrChecker { - typedef std::function AttrChecker; + typedef std::function AttrChecker; public: template @@ -304,7 +304,7 @@ class OpAttrChecker { return *(checker.target>()); } - void Check(AttributeMap& attr_map) const { // NOLINT + void Check(const AttributeMap& attr_map) const { for (const auto& checker : attr_checkers_) { checker(attr_map); } -- GitLab