www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Class allocators

reply =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
Have anybody used allocators to construct class instances?
Nov 11 2017
next sibling parent Eugene Wissner <belka caraus.de> writes:
On Saturday, 11 November 2017 at 14:26:34 UTC, Nordlöw wrote:
 Have anybody used allocators to construct class instances?
Do you mean phobos allocators? or allocators as concept? What is the problem?
Nov 11 2017
prev sibling parent reply Eduard Staniloiu <edi33416 gmail.com> writes:
On Saturday, 11 November 2017 at 14:26:34 UTC, Nordlöw wrote:
 Have anybody used allocators to construct class instances?
I might be wrong, but I think you are looking for std.experimental.allocator.make [0] [0] - https://dlang.org/phobos/std_experimental_allocator.html#make
Nov 12 2017
parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Sunday, 12 November 2017 at 18:34:42 UTC, Eduard Staniloiu 
wrote:
 On Saturday, 11 November 2017 at 14:26:34 UTC, Nordlöw wrote:
 Have anybody used allocators to construct class instances?
I might be wrong, but I think you are looking for std.experimental.allocator.make [0] [0] - https://dlang.org/phobos/std_experimental_allocator.html#make
Thanks! In the example the classes are declared as static. What effect does this have here and is it required for classes allocated via make?
Nov 12 2017
parent reply Basile B. <b2.temp gmx.com> writes:
On Sunday, 12 November 2017 at 18:46:54 UTC, Per Nordlöw wrote:
 On Sunday, 12 November 2017 at 18:34:42 UTC, Eduard Staniloiu 
 wrote:
 On Saturday, 11 November 2017 at 14:26:34 UTC, Nordlöw wrote:
 Have anybody used allocators to construct class instances?
I might be wrong, but I think you are looking for std.experimental.allocator.make [0] [0] - https://dlang.org/phobos/std_experimental_allocator.html#make
Thanks! In the example the classes are declared as static. What effect does this have here and is it required for classes allocated via make?
No, the classes and structs of the examples are simply declared as 'static' because they are located in a 'unittest' block. You can ignore the keyword...it just means that they are declared as if they would stand at the global scope.
Nov 12 2017
parent =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Sunday, 12 November 2017 at 20:41:03 UTC, Basile B. wrote:
 No, the classes and structs of the examples are simply declared 
 as 'static' because they are located in a 'unittest' block. You 
 can ignore the keyword...it just means that they are declared 
 as if they would stand at the global scope.
Thanks.
Nov 12 2017