【发布时间】:2018-11-08 17:39:05
【问题描述】:
我应该如何为带有指针的向量做移动构造函数?
例如:
我在 A 类中有这个字段 - vector<A*> AList;
在函数(A &&otherA)(即移动构造函数)中,
我应该这样写:AList(std::move(other.AList)) 还是其他方式?
【问题讨论】:
-
需要更多数据。
std:vector是 Rule of Five compliant,所以你不需要做任何事情。
标签: c++ pointers vector move-constructor