www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Are there any containers that go with allocators?

reply John Burton <john.burton jbmail.com> writes:
Normally I'm happy with the GC containers in D, they work well 
and suit my use.

I have a few uses that would benefit from allocation in memory 
arenas or local stack based allocation. Looks like 
std.experimental has allocators for those use cases.

But I can't find any containers to make use of those allocators. 
The built in ones use GC managed memory, there are std.container 
but they appear to use malloc/free which again is useful but not 
what I'm looking for.

I'd like resizeable arrays, hashmaps and strings that I can 
allocate using an allocator?
Am I missing something in the standard library, or a way to use 
the existing ones, or is it just that nobody has implemented this 
kind of thing yet?
Feb 09 2021
next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
https://github.com/dlang-community/containers

It uses the older design for allocators (dependency).
Feb 09 2021
parent John Burton <john.burton jbmail.com> writes:
On Tuesday, 9 February 2021 at 12:23:52 UTC, rikki cattermole 
wrote:
 https://github.com/dlang-community/containers

 It uses the older design for allocators (dependency).
Looks good, thank you
Feb 09 2021
prev sibling parent ryuukk_ <ryuukk_ gmail.com> writes:
On Tuesday, 9 February 2021 at 12:18:41 UTC, John Burton wrote:
 Normally I'm happy with the GC containers in D, they work well 
 and suit my use.

 I have a few uses that would benefit from allocation in memory 
 arenas or local stack based allocation. Looks like 
 std.experimental has allocators for those use cases.

 But I can't find any containers to make use of those 
 allocators. The built in ones use GC managed memory, there are 
 std.container but they appear to use malloc/free which again is 
 useful but not what I'm looking for.

 I'd like resizeable arrays, hashmaps and strings that I can 
 allocate using an allocator?
 Am I missing something in the standard library, or a way to use 
 the existing ones, or is it just that nobody has implemented 
 this kind of thing yet?
i use https://github.com/ikod/ikod-containers
Feb 13 2021