条款 25:考虑写一个不抛异常的 swap 函数
Consider support a non-throwing swap.
- 当 std::swap 效率不高时,提供一个不抛异常的 swap 成员函数
- 如果你提供一个 member swap,也应该提供一个 non-member swap 来调用前者,对于 classes(而非 templates)也请特化 std::swap
- 调用 swap 时针对 std::swap 使用 using 申明式,然后调用 swap 并不带命名空间资格修饰
- 为“用户自定义类型”进行 std templates 全特化是好的,但是不要在 std 中加入新的东西