aboutsummaryrefslogtreecommitdiff
path: root/src/list.hpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-08-29 10:24:24 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-08-29 10:29:48 -0400
commit94bbb46ca602be0ea0df97c207a98734ac459a0f (patch)
tree93199fdd18a2b788aa54667edcd67061e6bd779f /src/list.hpp
parent834a789bb96e65749299ce6c6e57688d699145eb (diff)
downloadzig-94bbb46ca602be0ea0df97c207a98734ac459a0f.tar.gz
zig-94bbb46ca602be0ea0df97c207a98734ac459a0f.zip
fix not fully resolving debug info for structs causing llvm error
Diffstat (limited to 'src/list.hpp')
-rw-r--r--src/list.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/list.hpp b/src/list.hpp
index f838e44a5b..8dce75f2b8 100644
--- a/src/list.hpp
+++ b/src/list.hpp
@@ -74,6 +74,17 @@ struct ZigList {
capacity = better_capacity;
}
+ T swap_remove(size_t index) {
+ if (length - 1 == index) return pop();
+
+ assert(index != SIZE_MAX);
+ assert(index < length);
+
+ T old_item = items[index];
+ items[index] = pop();
+ return old_item;
+ }
+
T *items;
size_t length;
size_t capacity;