diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-26 21:43:19 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-07-26 21:43:19 +0100 |
commit | ca7931e0c29785314d2fe88279dabd55c9afc7c2 (patch) | |
tree | 5a5ca3369b2e2d3d30bb3fef77ad9d567a8e3912 | |
parent | 7720544e07324de749b9f9fb6bb6d0d922af20eb (diff) | |
download | cw_tree-ca7931e0c29785314d2fe88279dabd55c9afc7c2.tar.gz cw_tree-ca7931e0c29785314d2fe88279dabd55c9afc7c2.tar.bz2 cw_tree-ca7931e0c29785314d2fe88279dabd55c9afc7c2.zip |
NodeAllocator constructor now reserves space in vector
This is different to vec{capacity}, which would adjust vec::size.
This adjusts vec::capacity instead, which is what I want.
-rw-r--r-- | src/numerics.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/numerics.cpp b/src/numerics.cpp index 66ddc02..33ee5ab 100644 --- a/src/numerics.cpp +++ b/src/numerics.cpp @@ -48,8 +48,9 @@ Node::Node(Fraction val, index_t left, index_t right) { } -NodeAllocator::NodeAllocator(word_t capacity) : vec{capacity} +NodeAllocator::NodeAllocator(word_t capacity) { + vec.reserve(capacity); } word_t NodeAllocator::alloc(Node n) |