From d4fccfc1faca811208283b3d291df07869f94e5b Mon Sep 17 00:00:00 2001 From: Ralph Urlus Date: Mon, 27 May 2024 13:38:48 +0200 Subject: [PATCH] CHG: [C++] Increase reserved heap-size for element swapping --- src/sparse_dot_topn_core/include/sparse_dot_topn/maxheap.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sparse_dot_topn_core/include/sparse_dot_topn/maxheap.hpp b/src/sparse_dot_topn_core/include/sparse_dot_topn/maxheap.hpp index 2d07ce8..5a3bbe5 100644 --- a/src/sparse_dot_topn_core/include/sparse_dot_topn/maxheap.hpp +++ b/src/sparse_dot_topn_core/include/sparse_dot_topn/maxheap.hpp @@ -59,7 +59,7 @@ class MaxHeap { * \param initial initial `val` to set for all the entries */ explicit MaxHeap(int n, eT initial) : heap_size{n}, init{initial} { - heap.reserve(n); + heap.reserve(n + 1); for (int i = 0; i < heap_size; i++) { heap.push_back({max_order, -1, initial}); }