From 040d79e1b99d952907167b9688b776920ad1d300 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Wed, 11 Jun 2025 08:15:50 -0400 Subject: [PATCH] container/queue: Let queues be re-initialized with different allocators --- core/container/queue/queue.odin | 9 ++++++--- 1 file 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) }