Commit e986ef16 authored by Branislav Katreniak's avatar Branislav Katreniak

kj/vector: add methods operator = nullptr and truncate

=nullptr releases memory

https://github.com/sandstorm-io/capnproto/issues/292
parent c242a3a0
......@@ -103,6 +103,22 @@ public:
}
}
inline void operator=(decltype(nullptr)) {
builder = nullptr;
}
inline void clear() {
while (builder.size() > 0) {
builder.removeLast();
}
}
inline void truncate(size_t size) {
while (builder.size() > size) {
builder.removeLast();
}
}
private:
ArrayBuilder<T> builder;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment