Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code stype about pass parameter by value, by reference and by rvalue reference #789

Closed
wadeliuyi opened this issue Aug 15, 2019 · 1 comment
Assignees
Labels
type/enhancement Type: make the code neat or more efficient

Comments

@wadeliuyi
Copy link
Contributor

wadeliuyi commented Aug 15, 2019

I see that in function define:
MetaClient::alterEdgeSchema(GraphSpaceID spaceId,
std::string name,
std::vector < cpp2::AlterSchemaItem > items,
nebula::cpp2::SchemaProp schemaProp)

the vector is pass by value,

and when call the function in void HBaseStore::asyncMultiPut(GraphSpaceID spaceId,
PartitionID partId,
std::vector keyValues,
KVCallback cb) {
std::vector<std::pair<std::string, std::vector>> dataList;
// push some value to dataList

ResultCode code = client_->multiPut(tableName, dataList); // pass by value directly.

...
}

and in Metaclient unit test, it pass by value too.

maybe there other place is not right too.

what more: I think pass by rvalue reference is better than pass by value, it can less one rvalue constructor called.

@darionyaphet darionyaphet added the type/enhancement Type: make the code neat or more efficient label Aug 16, 2019
@darionyaphet darionyaphet self-assigned this Aug 16, 2019
@darionyaphet
Copy link
Contributor

darionyaphet commented Aug 16, 2019

It's like what I talk to @wadeliuyi offline. It's a good suggestion thanks :)

liwenhui-soul pushed a commit to liwenhui-soul/nebula that referenced this issue May 10, 2022
Co-authored-by: Yichen Wang <18348405+Aiee@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Type: make the code neat or more efficient
Projects
None yet
Development

No branches or pull requests

3 participants