|
Boost : |
Subject: Re: [boost] [Boost.Pool] TR1?
From: Phil Bouchard (philippe_at_[hidden])
Date: 2011-04-12 21:07:06
On 4/12/2011 5:43 PM, Phil Bouchard wrote:
> On 4/12/2011 4:06 PM, Phil Bouchard wrote:
>>
>> Is that so? I guess it'll be different if you have:
>>
>> struct Silly
>> {
>> bool is_from_heap(const char* p)
>> { return heap<= p&& p< heap + sizeof(heap); }
>>
>> char data[1024];
>> char heap[1024];
>> char stack[1024];
>> };
>
> ... and "p" is guaranteed to be part of either the data, heap or stack
> buffer.
To embellish the structure it could be renamed to:
struct
{
pool data, heap, stack;
} process;
Where the default implementation of the global operator ::new could be:
void * operator new(size_t n) { return ::process.heap.malloc(n); }
If you call is_from() with a pointer p then pointer p is guaranteed to
be part of one of the pools mentioned above.
-Phil
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk