I'd like to create an object bool using a vector of type X objects. When I create the vector:
vector<X>* v = new vector<X>;
v.reserve(10000);
I want the minimal work done as possible. Will just the default constructor get called (my default constructor is empty for X)?
Later on in my program how do I "create" my object using the object pool? Would it be something like:
int y = get_next_object_in_pool();
X x = v[y];
where get_next_object_in_pool()
just keeps an index to the next free index in the vector?