www.digitalmars.com         C & C++   DMDScript  

D - Syntax challenge: new / delete

I am looking for C++ syntax options for the following problem, but it
applies to D as well:

Suppose I have different sources from which I can allocate memory:
- global
- current module / component
- current process
- current thread

what is the 'prettiest' / most natural way to code this? (in C++ / D)

For example (C++ syntax):
    Object* o = new (THREAD) Object( ... )

Alternatives are perhaps:
- template (-functions)
- namespace-based solutions
- macro's
- ...

And what about D?
Jan 12 2004