From 03464d654043ba2380b408d7d0b2619ae0db7b76 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Mon, 7 Dec 2020 04:10:05 -0600 Subject: [PATCH] fix: use ref in setTreeFiltererCandidates --- src/fuzzaldrin.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fuzzaldrin.cc b/src/fuzzaldrin.cc index c272b67f..646f0e08 100644 --- a/src/fuzzaldrin.cc +++ b/src/fuzzaldrin.cc @@ -64,11 +64,11 @@ Napi::Value Fuzzaldrin::setTreeFiltererCandidates(const Napi::CallbackInfo &info const string childrenKey = info[2].As(); // create Tree and set candidates - _tree = Tree(jsTreeArray, dataKey, childrenKey); + _tree = Tree(move_const(jsTreeArray), move_const(dataKey), move_const(childrenKey)); - const auto &candidates = _tree.entriesArray; + const auto candidates = ref(_tree.entriesArray); - const auto N = candidates.size();// different + const auto N = candidates.get().size();// different const auto num_chunks = N < 1000 * kMaxThreads ? N / 1000 + 1 : kMaxThreads; candidates_.clear(); candidates_.resize(num_chunks); @@ -80,7 +80,7 @@ Napi::Value Fuzzaldrin::setTreeFiltererCandidates(const Napi::CallbackInfo &info chunk_size++; } for (auto j = cur_start; j < cur_start + chunk_size; j++) { - candidates_[i].emplace_back(candidates[j].data);// different // TODO copy + candidates_[i].emplace_back(candidates.get()[j].data);// different // TODO copy } cur_start += chunk_size; }