标准不对移动构造函数强制执行 noexcept。在什么情况下可以/必须抛出移动构造函数?
最佳答案
当你真的别无选择时。大多数时候你的移动构造函数应该是noexcept
。它们是默认设置。
It is especially important to use noexcept for types that are intended to be used with the standard library containers. If the move constructor for an element type in a container is not noexcept then the container will use the copy constructor rather than the move constructor.
关于c++ - 我什么时候应该声明一个没有 noexcept 的移动构造函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26922113/