Boost logo

Boost :

From: Michel André (michel.andre_at_[hidden])
Date: 1999-11-23 15:54:52

howard hinnant <hinnan-_at_[hidden]> wrote:
original article:
> In a std::container memory can not allocated be allocated by new.
> Instead an Allocator class is passed in as a template parameter and
> optionally through the contructor as well. So internal to vector for
> example you might have code that looks like:
> data_ = alloc_.allocate(n);
> capacity_ = n;
> ...
> alloc_.deallocate(data_, capacity_);
> I was hoping to do something more like:
> data_.reset(data_.allocate(n), n);
> or something like that. Haven't had time to really work out the
> But what you suggest below is really what I'm after: The ability to
> "auto_ptr" in the implementation. this "auto_ptr" will have to use
> vector's allocator to deallocate the memory. And the vector's
> needs the capacity sent to the deallocate method.
> Might be a dead end, don't know yet...

Ok and make the rebind struct and typedef inside as a part of your
standard allocator so it can be passed in to the auto_ptr used into
your container implementation?



Boost list run by bdawes at, gregod at, cpdaniel at, john at