Well, the objects need to be stored somewhere.
What is wrong with shared_ptr or intrusive_ptr ? This is user problem, how he wants to allocate his object. Even more he can use different allocation strategies for objects in same collecion.
If we don't want to deal with reallocation,
What realloctation ? Without copy constructor ... ?
we need a container whose iterators are stable under insert, for example a list or a set.
As mentioned in previous postings these containers require copy constructor ... so you can forget about using them directly for storing objects. It would be better to use some kind of pool, if you want, but such container would be very restricted in use, because user can not select it's own allocation strategy. My opinion is that container should deal with some kind of pointers, but not with real data. Imagine you have descendant objects of the same base class in one collection ... so which allocation strategy you propose in this case ... ?
You are now able to use the iterator to that container to access the objects.
std::vector <someIterator> v; v[123]->functionCall(); or v.front()-> dataMember; or (*v.begin())-> dataMember;
Would that help?
Obviously, not! There is still interface problem: std::vector <someIterator>::iterator doesn't behave like normal item operator. You still should write : iterator i = ...; iterator last = ...; (**i).dataMember; // not a simple i->dataMember; (*i)->dataMember; // not a simple (*i).dataMember; // and this is obviously is not the case for your library user: i = remove_adaptor( find_if( make_adaptor(i), make_adaptor(last), condition ) ); Possibly, i was unclear in my previous postings, but IMHO this is interface problem, not allocation or implementation. Simple questions are : 1) how to put value in container push_back( pointer ); or push_back( reference ); 2) how replace value in container having only iterator: iterator i = collection.begin(); *i.base_iterator() = new_pointer; ? 3) should container have two kinds of iterators : base_iterator & adapted_iterator ? 4) inherit contained object from some collection_item class that knows something about collection. For example: simple delete ptr can delete object from collection. // i know this not good idea :-) regards, bohdan