21 Nov 21:43
Re: std::vector and default constructor
Andrew Sutton <andrew.n.sutton <at> gmail.com>
2008-11-21 20:43:54 GMT
2008-11-21 20:43:54 GMT
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.
I think you could probably do this by building a custom allocator, so you could write something like:
vector<T, default_value_allocator<T, some_value> > v;
This could just be a simple wrapper around the default allocator.
vector<T, default_value_allocator<T, some_value> > v;
This could just be a simple wrapper around the default allocator.
Andrew Sutton
andrew.n.sutton <at> gmail.com
_______________________________________________ Boost-users mailing list Boost-users <at> lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
RSS Feed