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

手撕代码里面的手写String类里面的移动构造函数是不是错了啊? #10

Open
Y1sh-kenny opened this issue May 15, 2023 · 2 comments

Comments

@Y1sh-kenny
Copy link

String::String(const String&& other)
{
m_data = other.m_data;
other.m_data = nullptr;
}
传入const的对象怎么修改other.m_data呢?
应该改成
String::String(String &&other)
{
m_data = other.m_data;
other.m_data = nullptr;
}

@guaguaupup
Copy link
Owner

感谢提醒,我改一下

@Y1sh-kenny
Copy link
Author

Y1sh-kenny commented Oct 14, 2023 via email

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

2 participants