It would be helpful to have something like std::vector which allows one to pass some argument which is in turn passed to the constructor of every element so that not the default constructor is being called.

This would be helpful for e.g. objects located in memory created by memory mapped files.

 

Peter

 

"The first point (using an init() function in preference to a constructor) is bogus. Using constructors and exception handling is a more general and systematic way of dealing with resource acquisition and initialization errors. This style is a relic of pre-exception C++." -- Stroustrup