diff options
author | Arne H Juul <arnej27959@users.noreply.github.com> | 2021-03-12 10:46:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-12 10:46:48 +0100 |
commit | 37d68e79fec3070078d431616f215dfb62099586 (patch) | |
tree | 0bc849b3a8d9123fc42084e2ee2526aef2370691 | |
parent | 6cd2a39ccb1a62c10dfae5adf9eba40eddf2c2c6 (diff) | |
parent | 7fd2b183dc0f6b952d40724e7057dcad902ad6c6 (diff) |
Merge pull request #16916 from vespa-engine/arnej/prepare-nnb-for-more-celltypes
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> |