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

赋值操作符自我赋值情况考虑 #51

Open
DongwenHuang opened this issue Aug 31, 2015 · 3 comments
Open

赋值操作符自我赋值情况考虑 #51

DongwenHuang opened this issue Aug 31, 2015 · 3 comments

Comments

@DongwenHuang
Copy link

const Buffer& Buffer::operator=(const Buffer& other) {
Free();
ShallowCopy(other);
return *this;
}

你好,请问这个函数是否没有考虑 a=a这种自我赋值的情况呢

@DongwenHuang
Copy link
Author

不用加个this=&other判断么

@liyichao
Copy link
Contributor

liyichao commented Dec 5, 2016

Yeah, it is a bug. Could you open a pull request ?

@dccmx
Copy link
Collaborator

dccmx commented Dec 6, 2016

因为这个不是个通用库,所以,kids 里面没有这种情况,就没有虑这个问题。

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

3 participants