Lets say I have an object that I dynamically allocated. If I push it into a STL vector, will a reference be inserted into the vector or a copy of this object?
It's a general question. For example:
class vec {
vector<obj> vec;
void addToVec(obj a) {
// insert a into vec
}
...
...
...
}
obj* a = new obj;
vec* v = new vec;
vec.addToVec(a);
If I delete v, will object a die as well?