Re: Using private constructor with std.experimental.allocater:make

2016-05-02 Thread Basile B via Digitalmars-d-learn
On Monday, 2 May 2016 at 04:19:48 UTC, earthfront wrote: On Sunday, 1 May 2016 at 19:18:38 UTC, Basile B wrote: CT make(CT, Alloc, A...)(auto ref Alloc al, A a) This works. Thank you. Good point about __ctor alone not being sufficient. auto memory = al.allocate(size); ...

Re: Using private constructor with std.experimental.allocater:make

2016-05-01 Thread earthfront via Digitalmars-d-learn
On Sunday, 1 May 2016 at 19:18:38 UTC, Basile B wrote: CT make(CT, Alloc, A...)(auto ref Alloc al, A a) This works. Thank you. Good point about __ctor alone not being sufficient. auto memory = al.allocate(size); ... GC.addRange(memory.ptr, size, typeid(CT)); Nit:

Re: Using private constructor with std.experimental.allocater:make

2016-05-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Sun, 01 May 2016 18:27:51 + Lass Safin via Digitalmars-d-learn wrote: > On Sunday, 1 May 2016 at 11:17:27 UTC, earthfront wrote: > > Hello! > > [...] > > class A > >{ int b; private this(int a){b=a;} } > > [...] > > I don't think classes are

Re: Using private constructor with std.experimental.allocater:make

2016-05-01 Thread Basile B via Digitalmars-d-learn
On Sunday, 1 May 2016 at 11:17:27 UTC, earthfront wrote: Hello! This code fails: - void main(){ class A { int b; private this(int a){b=a;} } //{ int b; this(int a){b=a;} } import std.conv:emplace; import std.experimental.allocator.mallocator:Mallocator; import

Re: Using private constructor with std.experimental.allocater:make

2016-05-01 Thread Lass Safin via Digitalmars-d-learn
On Sunday, 1 May 2016 at 11:17:27 UTC, earthfront wrote: Hello! [...] class A { int b; private this(int a){b=a;} } [...] I don't think classes are supposed to be able to have a private constructor...

Using private constructor with std.experimental.allocater:make

2016-05-01 Thread earthfront via Digitalmars-d-learn
Hello! This code fails: - void main(){ class A { int b; private this(int a){b=a;} } //{ int b; this(int a){b=a;} } import std.conv:emplace; import std.experimental.allocator.mallocator:Mallocator; import std.experimental.allocator:make; { auto ptr =