In early versions of the C 11 standard, the implicit generation of move constructors and assignment operators was a topic of debate. This led to changes in subsequent drafts, resulting in the following behavior in currently available compilers:
Since the November release of the C Standard (N3225), implicit move constructors and assignment operators can be generated under the following conditions:
The decision not to include default move constructor/assignment implementations in early drafts was a result of concerns about the potential for confusion and unexpected behavior. However, subsequent revisions have addressed these concerns by tightening the conditions for implicit move generation.
If you're looking for a way to utilize move semantics without writing explicit move constructors/assignment operators, you can use [GManNickG's macro](https://stackoverflow.com/a/12316884/8674521). This macro generates the necessary move semantics for your class.
By implementing move semantics, you can opt out of providing a swap member function as well.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3