Skip to content

Conversation

@sergey-semenov
Copy link
Contributor

No description provided.

}

device_image_impl(const std::string &Src, context Context,
device_image_impl(const std::string &Src, const context &Context,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an expert on the best practices, but I think std::move could be better on average:

device_image_impl obj(..., create_rval_context(), ...); // 1
device_image_impl obj(..., lval_context, ...);          // 2

For by-value param followed by a std::move we'd have two move-ctors (1) and copy-ctor + move-ctor (2).

For by-const-ref we'll have copy-ctor (1) and copy-ctor. Effectively, we remove one move-ctor (cheap) in either case and introduce a more expensive copy-ctor in (1).

That said, it's probably unlikely to matter in practice, so LGTM.

+ @vinser52 in case we need to update our "informal style guides".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it this way mostly to align with the rest of the constructors, but I do prefer pass-by-value then move as well. And, on closer inspection, we actually have a weird mix of the two in this file, so I'll update the PR to use that instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants