PragmaTwice commented on code in PR #2850:
URL: https://github.com/apache/kvrocks/pull/2850#discussion_r2015550616


##########
src/cluster/cluster.cc:
##########
@@ -23,24 +23,33 @@
 #include <config/config_util.h>
 
 #include <array>
+#include <cstdint>
 #include <cstring>
 #include <fstream>
 #include <memory>
+#include <string>
+#include <string_view>
 #include <vector>
 
 #include "cluster/cluster_defs.h"
 #include "commands/commander.h"
 #include "common/io_util.h"
+#include "fmt/base.h"
 #include "fmt/format.h"
 #include "parse_util.h"
 #include "replication.h"
 #include "server/server.h"
 #include "string_util.h"
 #include "time_util.h"
 
-ClusterNode::ClusterNode(std::string id, std::string host, int port, int role, 
std::string master_id,
-                         const std::bitset<kClusterSlots> &slots)
-    : id(std::move(id)), host(std::move(host)), port(port), role(role), 
master_id(std::move(master_id)), slots(slots) {}
+ClusterNode::ClusterNode(std::string &&id, std::string &&host, int port, int 
role, std::string &&master_id,

Review Comment:
   Some notes:
   1. for `std::bitset`, in most impl it is stored on the stack memory instead 
heap so move ctor has no difference from the copy ctor. usually you don't need 
to move it. 
   2. for `ClassA(std::string x) : x(x) {}`, you can pass either lval or rval 
to it. for rval, it involves two move ctor. And for `ClassA(std::string &&x) : 
x(x) {}`, you can only pass rval to it, and also the performance difference is 
quite little or none.
   
   So these changes are not so useful.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to