Thread overview
Class allocators
Nov 11, 2017
Nordlöw
Nov 11, 2017
Eugene Wissner
Nov 12, 2017
Eduard Staniloiu
Nov 12, 2017
Per Nordlöw
Nov 12, 2017
Basile B.
Nov 12, 2017
Nordlöw
November 11, 2017
Have anybody used allocators to construct class instances?
November 11, 2017
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?
November 12, 2017
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
November 12, 2017
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?
November 12, 2017
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.
November 12, 2017
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.