|
Boost Users : |
Subject: Re: [Boost-users] std::vector and default constructor
From: peter_foelsche_at_[hidden]
Date: 2008-11-21 16:29:49
what about if I have more than one memory mapped file and multiple such vectors in separate memory mapped io areas?
I think the method you're suggesting uses global variables, doesn't it?
Peter
________________________________
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Andrew Sutton
Sent: Friday, November 21, 2008 12:44
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] std::vector and default constructor
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.
Andrew Sutton
andrew.n.sutton_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net