'new' class method

KennyTM~ kennytm at gmail.com
Thu Oct 23 23:32:23 PDT 2008


Bill Baxter wrote:
> On Fri, Oct 24, 2008 at 6:28 AM, Sergey Gromov <snake.scaly at gmail.com> wrote:
>> Fri, 24 Oct 2008 05:31:44 +0900,
>> Bill Baxter wrote:
>>> But, ok, this isn't Python so we have to have a story for placement new.
>>> I believe use of placement new is pretty rare.  (I use it rarely,
>>> anyway. :-) )   If so it should be ok if the syntax is a little
>>> clunky.
>> Maybe do it with a library function?
>>
>> auto c = core.intrinsic.construct!(C)(addr, ctor_arg0, ctor_arg1);
> 
> The current placement new in D can take an arbitrary list of args.  So
> you have two lists -- new_args and ctor_args.
> 
> --bb

Can a library function return a constructor? Like this:

auto c = core.intrinsic.construct!(C)(addr, new_args...)(ctor_args ...);

But that's similar to C.new(addr, new_args...)(ctor_args...);



More information about the Digitalmars-d mailing list