On the richness of C++

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Apr 11 07:03:14 PDT 2008


Frits van Bommel wrote:
> Sean Kelly wrote:
[snip]
>>     class Object {
>>         void* new( size_t s, void* p ) {
>>             return p;
>>         }
>>     }
> 
> Might I suggest that if you ever again get the urge to add placement 
> new, you consider adding
> ---
> void* new( size_t s, void[] arr ) {
>     assert(s <= arr.length);
>     return arr.ptr;
> }
> ---
> instead?

Oh, and after reading the spec: the 'void*' in front of 'new' shouldn't 
be there. Like with constructors, the return type is implicit.



More information about the Digitalmars-d mailing list