is it stack or heap?
-
possibly a dump question, but better be safe.... if I have a class like this:
class Foo { std::vector vectorWithFoo2; };
and then allocate a pointer of FooFoo* pFoo = new Foo;
the pFoo is allocated in the heap, right? Now, each time I push_back a Foo2 into the vector, is it stored in the stack or the heap? I think its the heap but I wanted to be sure... -
possibly a dump question, but better be safe.... if I have a class like this:
class Foo { std::vector vectorWithFoo2; };
and then allocate a pointer of FooFoo* pFoo = new Foo;
the pFoo is allocated in the heap, right? Now, each time I push_back a Foo2 into the vector, is it stored in the stack or the heap? I think its the heap but I wanted to be sure... -
yes, pFoo is allocated in the heap. And the vector internal allocation is done in the heap.
thanks