From: Kefu Chai Date: Sat, 29 Apr 2017 18:04:51 +0000 (+0800) Subject: crush: pass by const reference to kill compiling error X-Git-Tag: v12.0.3~150^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c8ca98ed02b38d11672ee7f86ebf977289cdf403;p=ceph.git crush: pass by const reference to kill compiling error i have following error when compiling with gcc-6 on armhf ceph/src/crush/CrushCompiler.cc: In member function 'int CrushCompiler::decompile(std::ostream&)': ceph/src/crush/CrushCompiler.cc:462:45: error: invalid initialization of non-const reference of type 'std::pair&' from an rvalue of type 'std::pair' int ret = decompile_choose_args(i, out); Signed-off-by: Kefu Chai --- diff --git a/src/crush/CrushCompiler.cc b/src/crush/CrushCompiler.cc index 4e0df956b652..ac5599250ca1 100644 --- a/src/crush/CrushCompiler.cc +++ b/src/crush/CrushCompiler.cc @@ -287,7 +287,7 @@ int CrushCompiler::decompile_choose_arg_map(crush_choose_arg_map arg_map, return 0; } -int CrushCompiler::decompile_choose_args(std::pair &i, +int CrushCompiler::decompile_choose_args(const std::pair &i, ostream &out) { out << "choose_args " << i.first << " {\n"; diff --git a/src/crush/CrushCompiler.h b/src/crush/CrushCompiler.h index 3a93085597c3..5146480683b0 100644 --- a/src/crush/CrushCompiler.h +++ b/src/crush/CrushCompiler.h @@ -36,7 +36,7 @@ class CrushCompiler { ostream &out); int decompile_choose_arg_map(crush_choose_arg_map arg_map, ostream &out); - int decompile_choose_args(std::pair &i, + int decompile_choose_args(const std::pair &i, ostream &out); int decompile_bucket_impl(int i, ostream &out); int decompile_bucket(int cur,