Boost logo

Boost :

From: Gary.Zhang_at_[hidden]
Date: 2001-10-11 13:10:39


Hi I am trying to add an interface to pool using overloaded
new/delete operators. The benefits are that
1) users do not need to be aware of the source of memory,
2) users can switch between various new/delete and compare
their performance.

I have the following problems.
1) the overloaded operator new [] does not provide
element size or the number of elements, instead it provides
size_t for the total number of bytes: sizeof(element) * N.

I am aware system actually keeps such information in a compiler
dependent way (through over allocation or associative array).
How do I get the information in a standard way ?

2) I can't somehow put new/delete operator inside a
namespace though the global new/delete can be used as
::new and ::delete.
For example,
namespace pool {
void * operator new (size_t s)
}

Widget *p = pool::new Widget // compilation error !

What is the correct way to do this ?

Gary


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk