class C
{
public:
C(C&&) = default; // (1)
C& operator=(C&&) = default; // (1)
C(C&&) noexcept = default; // (2)
C& operator=(C&&) noexcept = default; // (2)
}
As far as I know, if move constructor/assignment operator are either implicitly generated or explicitly defaulted by user (1)
, the compiler will decide whether these special member functions should be noexcept
or not depending on whether all the members of a class provide noexcept
guarantees for move operations. But what if I want to use default move special members and force them to be noexcept
regardless of the underlying members exception guarantees for move operations? Is there any difference for the compiler between (1)
and (2)
declarations?