以下所有陈述都是正确的吗?
vector<Type> vect; //allocates vect on stack and each of the Type (using std::allocator) also will be on the stack
vector<Type> *vect = new vector<Type>; //allocates vect on heap and each of the Type will be allocated on stack
vector<Type*> vect; //vect will be on stack and Type* will be on heap.
Run Code Online (Sandbox Code Playgroud)
如何存储在内部分配Type的vector或任何其他STL容器?
如果std :: vector和朋友自我调整大小,这是否意味着如果我声明一个这样的向量:
std::vector<string> myvec;
Run Code Online (Sandbox Code Playgroud)
然后它将使用更多堆栈调整大小,而:
std::vector<string> *myvec = new std::vector<string>();
Run Code Online (Sandbox Code Playgroud)
会使用更多堆调整大小吗?