In C++ (unlike Java), you can create objects either on the stack or the heap. An example of creating it on the stack is, as you have done:
vector<SomeClass> theVector;
This object goes out of scope when the stack frame disappears (normally when you return from the function that created the object.
Creating objects on the heap allows them to outlive the function that created them and you do that by performing:
vector<SomeClass> *theVectorPtr = new vector<SomeClass>();
You can then pass the theVectorPtr
pointer back to the caller of the function (or store it globally, whatever you want).
In order to get rid of the object on the heap, you explicitly delete it:
delete theVectorPtr;
somewhere in your code.
Deleting an object on the heap ends the scope of that object, the same way returning from a function ends the scope of variables created on the stack.