From 0caa0012eba38f5f047ae0887ce9fb50953e9fe9 Mon Sep 17 00:00:00 2001 From: AlexanderSaydakov Date: Mon, 7 Mar 2022 12:47:09 -0800 Subject: [PATCH] added forwarding --- kll/include/kll_sketch_impl.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kll/include/kll_sketch_impl.hpp b/kll/include/kll_sketch_impl.hpp index f623f2f8..8839589d 100644 --- a/kll/include/kll_sketch_impl.hpp +++ b/kll/include/kll_sketch_impl.hpp @@ -182,11 +182,11 @@ void kll_sketch::merge(FwdSk&& other) { throw std::invalid_argument("incompatible M: " + std::to_string(m_) + " and " + std::to_string(other.m_)); } if (is_empty()) { - min_value_ = new (allocator_.allocate(1)) T(*other.min_value_); - max_value_ = new (allocator_.allocate(1)) T(*other.max_value_); + min_value_ = new (allocator_.allocate(1)) T(conditional_forward(*other.min_value_)); + max_value_ = new (allocator_.allocate(1)) T(conditional_forward(*other.max_value_)); } else { - if (C()(*other.min_value_, *min_value_)) *min_value_ = *other.min_value_; - if (C()(*max_value_, *other.max_value_)) *max_value_ = *other.max_value_; + if (C()(*other.min_value_, *min_value_)) *min_value_ = conditional_forward(*other.min_value_); + if (C()(*max_value_, *other.max_value_)) *max_value_ = conditional_forward(*other.max_value_); } const uint64_t final_n = n_ + other.n_; for (uint32_t i = other.levels_[0]; i < other.levels_[1]; i++) {