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

move的描述问题 #2

Open
Mq-b opened this issue Oct 15, 2023 · 0 comments
Open

move的描述问题 #2

Mq-b opened this issue Oct 15, 2023 · 0 comments

Comments

@Mq-b
Copy link

Mq-b commented Oct 15, 2023

写的是:

move的作用:
进行语义转移,将一个对象的所有权或者说管理权转移到另一个对象上

我不知道这个 move 是否指代 std::move,但我觉得这个语境大概率是。
std::move 本身并不转移所有权,这个解释是错误的。
std::move 只是一个模板函数,无条件的将传入对象转换到右值引用,这个函数调用表达式,是亡值表达式(右值表达式的一种),通过 std::move 去匹配其他类型的移动构造,然后根据移动构造的实现,去转移所有权。

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

No branches or pull requests

1 participant