Are move constructors produced automatically?

前端 未结 2 1679
[愿得一人]
[愿得一人] 2020-11-28 08:37

I have a big class holding a lot of STL containers.
Will the compiler automatically make a move constructor that will move those containers to the target or I have to ma

2条回答
  •  情歌与酒
    2020-11-28 09:15

    Default move constructors are generally tied to default copy constructors. You get one when you get the other. However, if you write a copy constructor/assignment operator, then no default copy and move constructors/assignment operators are written. If you write one of either set, you must write them all.

提交回复
热议问题