We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
“所有权机制只针对在堆上分配的数据,而基本类型的存储都是在栈上,因此其没有所有权的概念。”
书中这段表述是不对的。let关键字将一个变量与一个值绑定在一起,这个变量就拥有了这个值的所有权。不管该变量是分配在栈上的基本数据类型,还是分配在堆上的数据类型,都是有所有权概念的。只不过一个是执行的是复制语义,一个执行的是移动语义。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
“所有权机制只针对在堆上分配的数据,而基本类型的存储都是在栈上,因此其没有所有权的概念。”
书中这段表述是不对的。let关键字将一个变量与一个值绑定在一起,这个变量就拥有了这个值的所有权。不管该变量是分配在栈上的基本数据类型,还是分配在堆上的数据类型,都是有所有权概念的。只不过一个是执行的是复制语义,一个执行的是移动语义。
The text was updated successfully, but these errors were encountered: