diff options
author | Arne Juul <arnej@verizonmedia.com> | 2021-03-12 08:23:42 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2021-03-12 08:23:42 +0000 |
commit | 7fd2b183dc0f6b952d40724e7057dcad902ad6c6 (patch) | |
tree | 35ddc81d27cb2fbdbd85cdabf39f0a71f2768829 | |
parent | dd8c1a0e61639d0bd5bc3816f205420b5f187632 (diff) |
handle more cell types
-rw-r--r-- | searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp index 01f02748664..4d69bebe065 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/nearest_neighbor_blueprint.cpp @@ -23,24 +23,20 @@ template<typename LCT, typename RCT> void convert_cells(std::unique_ptr<Value> &original, const vespalib::eval::ValueType &want_type) { - auto old_cells = original->cells().typify<LCT>(); - std::vector<RCT> new_cells; - new_cells.reserve(old_cells.size()); - for (LCT value : old_cells) { - RCT conv = value; - new_cells.push_back(conv); + if constexpr (std::is_same<LCT,RCT>::value) { + return; + } else { + auto old_cells = original->cells().typify<LCT>(); + std::vector<RCT> new_cells; + new_cells.reserve(old_cells.size()); + for (LCT value : old_cells) { + RCT conv(value); + new_cells.push_back(conv); + } + original = std::make_unique<DenseCellsValue<RCT>>(want_type, std::move(new_cells)); } - original = std::make_unique<DenseCellsValue<RCT>>(want_type, std::move(new_cells)); } -template<> -void -convert_cells<float,float>(std::unique_ptr<Value> &, const vespalib::eval::ValueType &) {} - -template<> -void -convert_cells<double,double>(std::unique_ptr<Value> &, const vespalib::eval::ValueType &) {} - struct ConvertCellsSelector { template <typename LCT, typename RCT> |