[Fwd: allocators not conformant to standard]

Benjamin Kosnik bkoz@cygnus.com
Tue Aug 31 17:26:00 GMT 1999


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) {


??


More information about the Libstdc++ mailing list