This is an automated email from the ASF dual-hosted git repository.

xiaokang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-graphar.git


The following commit(s) were added to refs/heads/main by this push:
     new a8a5710e fix(c++): use std::move to reduce a copy (#843)
a8a5710e is described below

commit a8a5710e36ba7f952d550e08aebbb1b320a9a8de
Author: 姚军 <[email protected]>
AuthorDate: Tue Feb 10 15:10:41 2026 +0800

    fix(c++): use std::move to reduce a copy (#843)
---
 cpp/src/graphar/status.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/cpp/src/graphar/status.h b/cpp/src/graphar/status.h
index fee92da2..62e709ba 100644
--- a/cpp/src/graphar/status.h
+++ b/cpp/src/graphar/status.h
@@ -135,10 +135,10 @@ class Status {
    * @param code The error code of the status.
    * @param msg The error message of the status.
    */
-  Status(StatusCode code, const std::string& msg) {
+  Status(StatusCode code, std::string msg) {
     state_ = new State;
     state_->code = code;
-    state_->msg = msg;
+    state_->msg = std::move(msg);
   }
   /** Copy the specified status. */
   inline Status(const Status& s)
@@ -154,11 +154,12 @@ class Status {
   }
 
   /** Returns a success status. */
-  inline static Status OK() { return Status(); }
+  inline static Status OK() { return {}; }
 
   template <typename... Args>
   static Status FromArgs(StatusCode code, Args... args) {
-    return Status(code, util::StringBuilder(std::forward<Args>(args)...));
+    return Status(code,
+                  std::move(util::StringBuilder(std::forward<Args>(args)...)));
   }
 
   /** Returns an error status when some IO-related operation failed. */


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to