2 Matching Annotations
  1. Apr 2022
    1. std::move_if_noexcept will return a movable r-value if the object has a noexcept move constructor, otherwise it will return a copyable l-value. We can use the noexcept specifier in conjunction with std::move_if_noexcept to use move semantics only when a strong exception guarantee exists (and use copy semantics otherwise).

      如果在 move 过程中遇到异常,有什么办法可以处理?

    1. std::move can be used whenever we want to treat an l-value like an r-value for the purpose of invoking move semantics instead of copy semantics.

      std::move 在什么情况下可以使用?