This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Fwd: allocators not conformant to standard]



Hmm. I'm interested to see what ideas for implementing persistence have 
come up, if anybody's willing to share. I've gotten a lot of questions 
about this, and it seems as if using the hint argument 
for allocator::allocate(n, hint) as an aid to determine locality (20.4.1.1) 
is a pretty good way to do it. 

As Matt's pointed out, using a container address as a hint wouldn't work. 
It seems as if you could make the container's elements persistent though, as 
they could be passed in. . .  ie you could allocate elements and then 
pass in the returned pointer to allocated space as a hint argument to 
signify the intent to also allocate persistantly.

> See allocator<>::allocate(),
> in line 602 of stl_alloc.h.  As you'll see, we have a hint parameter and
> we don't do anything with it.

Perhaps the suggestion was to change 

  _Tp* allocate(size_type __n, const void* = 0) {

to
  _Tp* allocate(size_type __n, const void* __hint = 0) {


??

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]