Also, I would recommend that you either reconsider having the constant member variable, or use a vector<>.
Using a vector<T> won't work in this case, because the STL uses T::operator = in order to copy vector contents into new locations during memory reallocation. And there's no logical way to implement operator = when a const data member is present, which is the cause of this conversation. I could use std::list, since it doesn't do reallocation, but clients using this class in containers will most likely need random access iterators.
Any other ideas?
Easy option: Use a vector
. This will give you basically the behavior you want, with the ability to initialize the elements directly. The drawback is that the data will be dynamically allocated.
Another drawback is the interface is now pointers, not references. If you
don't mind the dynamic allocation, the vector