From: Kefu Chai Date: Fri, 29 Sep 2017 02:39:18 +0000 (+0800) Subject: common/options: pass by reference X-Git-Tag: v13.0.1~735^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d2364bde9b174c0b8e51bcd1ec9008361fa1a348;p=ceph.git common/options: pass by reference for better performance. and for better consistency, pass by std::initializer_list. Signed-off-by: Kefu Chai --- diff --git a/src/common/options.h b/src/common/options.h index b8e877069587..2765bd2467c7 100644 --- a/src/common/options.h +++ b/src/common/options.h @@ -91,7 +91,7 @@ struct Option { std::vector see_also; value_t min, max; - std::vector enum_allowed; + std::vector enum_allowed; bool safe; @@ -191,7 +191,7 @@ struct Option { tags.push_back(tag); return *this; } - Option& add_tag(std::initializer_list ts) { + Option& add_tag(const std::initializer_list& ts) { tags.insert(tags.end(), ts); return *this; } @@ -199,7 +199,7 @@ struct Option { services.push_back(service); return *this; } - Option& add_service(std::initializer_list ss) { + Option& add_service(const std::initializer_list& ss) { services.insert(services.end(), ss); return *this; } @@ -207,7 +207,7 @@ struct Option { see_also.push_back(t); return *this; } - Option& add_see_also(std::initializer_list ts) { + Option& add_see_also(const std::initializer_list& ts) { see_also.insert(see_also.end(), ts); return *this; } @@ -233,9 +233,9 @@ struct Option { return *this; } - Option& set_enum_allowed(const std::vector allowed) + Option& set_enum_allowed(const std::initializer_list& allowed) { - enum_allowed = allowed; + enum_allowed.insert(enum_allowed.end(), allowed); return *this; }