aboutsummaryrefslogtreecommitdiff
path: root/core/container/queue/queue.odin
diff options
context:
space:
mode:
authorFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-11 08:15:50 -0400
committerFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-11 11:55:30 -0400
commit040d79e1b99d952907167b9688b776920ad1d300 (patch)
treecb6faa971f8353a6fee2ffebe239e9b9058f4533 /core/container/queue/queue.odin
parent81f57634820279443abb7cc4fd3465477201e167 (diff)
container/queue: Let queues be re-initialized with different allocators
Diffstat (limited to 'core/container/queue/queue.odin')
-rw-r--r--core/container/queue/queue.odin9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/container/queue/queue.odin b/core/container/queue/queue.odin
index 75b00d376..7e3e18075 100644
--- a/core/container/queue/queue.odin
+++ b/core/container/queue/queue.odin
@@ -23,10 +23,13 @@ DEFAULT_CAPACITY :: 16
Initialize a `Queue` with a starting `capacity` and an `allocator`.
*/
init :: proc(q: ^$Q/Queue($T), capacity := DEFAULT_CAPACITY, allocator := context.allocator) -> runtime.Allocator_Error {
- if q.data.allocator.procedure == nil {
- q.data.allocator = allocator
- }
clear(q)
+ q.data = transmute([dynamic]T)runtime.Raw_Dynamic_Array{
+ data = nil,
+ len = 0,
+ cap = 0,
+ allocator = allocator,
+ }
return reserve(q, capacity)
}