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

2015/08/23/effective-cpp-25 #155

Open
utterances-bot opened this issue Mar 9, 2021 · 1 comment
Open

2015/08/23/effective-cpp-25 #155

utterances-bot opened this issue Mar 9, 2021 · 1 comment

Comments

@utterances-bot
Copy link

Effective C++ 25:考虑实现一个不抛异常的swap | Harttle Land

提供一个更加高效的,不抛异常的公有成员函数(比如Widget::swap)。在你类(或类模板)的同一命名空间下提供非成员函数swap,调用你的成员函数。如果你写的是类而不是类模板,请偏特化std::swap,同样应当调用你的成员函数。调用...

https://harttle.land/2015/08/23/effective-cpp-25.html

Copy link

aceyan commented Mar 9, 2021

感谢博主的总结与分享!!
有个地方似乎有个小瑕疵:

“如果你写的是类而不是类模板,请偏特化std::swap,同样应当调用你的成员函数。”

前面提到了函数模板不能够偏特化,但是这里使用了‘偏特化’,是否应该修改成‘特化’呢?

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