diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-09-16 18:00:10 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-09-16 18:00:10 +0000 |
commit | cefbaa26062e228262a39110ecabf7b031c69100 (patch) | |
tree | 426121df45c7232ad98a96667af4fabdccb03377 | |
parent | c48c65becbca835d03ebb75dcbc828d13eb0fe75 (diff) |
Avoid including smallvector in arrayref, then it is included 'everywhere'.
22 files changed, 36 insertions, 24 deletions
diff --git a/eval/src/tests/ann/doc_vector_access.h b/eval/src/tests/ann/doc_vector_access.h index 4d1460b8812..81ed436e274 100644 --- a/eval/src/tests/ann/doc_vector_access.h +++ b/eval/src/tests/ann/doc_vector_access.h @@ -1,11 +1,13 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once + #include <vespa/vespalib/util/arrayref.h> +#include <cstdint> template <typename FltType = float> struct DocVectorAccess { virtual vespalib::ConstArrayRef<FltType> get(uint32_t docid) const = 0; - virtual ~DocVectorAccess() {} + virtual ~DocVectorAccess() = default; }; diff --git a/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp b/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp index b51d882d406..b2fe30d83e0 100644 --- a/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp +++ b/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp @@ -11,6 +11,7 @@ #include <vespa/eval/eval/call_nodes.h> #include <vespa/eval/eval/tensor_nodes.h> #include <vespa/eval/eval/llvm/compile_cache.h> +#include <vespa/vespalib/util/small_vector.h> #include <optional> using namespace vespalib::eval::nodes; diff --git a/eval/src/vespa/eval/instruction/dense_tensor_peek_function.h b/eval/src/vespa/eval/instruction/dense_tensor_peek_function.h index 517d8ffc6e1..496f4ceaed7 100644 --- a/eval/src/vespa/eval/instruction/dense_tensor_peek_function.h +++ b/eval/src/vespa/eval/instruction/dense_tensor_peek_function.h @@ -3,6 +3,7 @@ #pragma once #include <vespa/eval/eval/tensor_function.h> +#include <vespa/vespalib/util/small_vector.h> namespace vespalib::eval { @@ -23,7 +24,7 @@ private: SmallVector<std::pair<int64_t,size_t>> _spec; public: DenseTensorPeekFunction(std::vector<Child> children, SmallVector<std::pair<int64_t,size_t>> spec); - ~DenseTensorPeekFunction(); + ~DenseTensorPeekFunction() override; const ValueType &result_type() const override { return DoubleValue::shared_type(); } void push_children(std::vector<Child::CREF> &children) const override; InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override; diff --git a/eval/src/vespa/eval/instruction/generic_concat.h b/eval/src/vespa/eval/instruction/generic_concat.h index 2fb5af88181..5b27988c5bd 100644 --- a/eval/src/vespa/eval/instruction/generic_concat.h +++ b/eval/src/vespa/eval/instruction/generic_concat.h @@ -6,7 +6,7 @@ #include <vespa/eval/eval/value_type.h> #include <vespa/eval/eval/interpreted_function.h> #include <vespa/vespalib/stllike/string.h> -#include <vector> +#include <vespa/vespalib/util/small_vector.h> namespace vespalib::eval { struct ValueBuilderFactory; } diff --git a/eval/src/vespa/eval/instruction/generic_join.cpp b/eval/src/vespa/eval/instruction/generic_join.cpp index 60dc3e55143..03c759c225f 100644 --- a/eval/src/vespa/eval/instruction/generic_join.cpp +++ b/eval/src/vespa/eval/instruction/generic_join.cpp @@ -51,7 +51,7 @@ generic_mixed_join(const Value &lhs, const Value &rhs, const JoinParam ¶m) } } return builder->build(std::move(builder)); -}; +} namespace { @@ -64,7 +64,7 @@ void my_mixed_join_op(State &state, uint64_t param_in) { auto &result = state.stash.create<std::unique_ptr<Value>>(std::move(up)); const Value &result_ref = *(result.get()); state.pop_pop_push(result_ref); -}; +} //----------------------------------------------------------------------------- @@ -95,7 +95,7 @@ void my_mixed_dense_join_op(State &state, uint64_t param_in) { assert(rhs == rhs_cells.end()); } state.pop_pop_push(state.stash.create<ValueView>(param.res_type, index, TypedCells(out_cells))); -}; +} //----------------------------------------------------------------------------- @@ -110,7 +110,7 @@ void my_dense_join_op(State &state, uint64_t param_in) { auto join_cells = [&](size_t lhs_idx, size_t rhs_idx) { *dst++ = fun(lhs_cells[lhs_idx], rhs_cells[rhs_idx]); }; param.dense_plan.execute(0, 0, join_cells); state.pop_pop_push(state.stash.create<DenseValueView>(param.res_type, TypedCells(out_cells))); -}; +} //----------------------------------------------------------------------------- @@ -119,7 +119,7 @@ void my_double_join_op(State &state, uint64_t param_in) { Fun fun(unwrap_param<JoinParam>(param_in).function); state.pop_pop_push(state.stash.create<DoubleValue>(fun(state.peek(1).as_double(), state.peek(0).as_double()))); -}; +} //----------------------------------------------------------------------------- diff --git a/eval/src/vespa/eval/instruction/generic_join.h b/eval/src/vespa/eval/instruction/generic_join.h index 72ae0b89d2c..7d9c6352868 100644 --- a/eval/src/vespa/eval/instruction/generic_join.h +++ b/eval/src/vespa/eval/instruction/generic_join.h @@ -6,6 +6,7 @@ #include <vespa/eval/eval/value_type.h> #include <vespa/eval/eval/operation.h> #include <vespa/eval/eval/interpreted_function.h> +#include <vespa/vespalib/util/small_vector.h> namespace vespalib { class Stash; } namespace vespalib::eval { struct ValueBuilderFactory; } @@ -64,7 +65,7 @@ struct SparseJoinPlan { bool should_forward_lhs_index() const; bool should_forward_rhs_index() const; SparseJoinPlan(const ValueType &lhs_type, const ValueType &rhs_type); - SparseJoinPlan(size_t num_mapped_dims); // full overlap plan + explicit SparseJoinPlan(size_t num_mapped_dims); // full overlap plan ~SparseJoinPlan(); }; diff --git a/eval/src/vespa/eval/instruction/generic_lambda.cpp b/eval/src/vespa/eval/instruction/generic_lambda.cpp index 2fe508fc310..1558d99b960 100644 --- a/eval/src/vespa/eval/instruction/generic_lambda.cpp +++ b/eval/src/vespa/eval/instruction/generic_lambda.cpp @@ -3,7 +3,7 @@ #include "generic_lambda.h" #include <vespa/eval/eval/llvm/compiled_function.h> #include <vespa/eval/eval/llvm/compile_cache.h> -#include <assert.h> +#include <vespa/vespalib/util/small_vector.h> using namespace vespalib::eval::tensor_function; diff --git a/eval/src/vespa/eval/instruction/generic_peek.cpp b/eval/src/vespa/eval/instruction/generic_peek.cpp index b1952cfefb7..a9900ce523e 100644 --- a/eval/src/vespa/eval/instruction/generic_peek.cpp +++ b/eval/src/vespa/eval/instruction/generic_peek.cpp @@ -8,6 +8,7 @@ #include <vespa/vespalib/util/typify.h> #include <vespa/vespalib/util/visit_ranges.h> #include <vespa/vespalib/util/shared_string_repo.h> +#include <vespa/vespalib/util/small_vector.h> #include <cassert> #include <map> diff --git a/eval/src/vespa/eval/instruction/generic_reduce.h b/eval/src/vespa/eval/instruction/generic_reduce.h index b9b6e7c5167..0e2a82ba6cc 100644 --- a/eval/src/vespa/eval/instruction/generic_reduce.h +++ b/eval/src/vespa/eval/instruction/generic_reduce.h @@ -6,6 +6,7 @@ #include <vespa/eval/eval/aggr.h> #include <vespa/eval/eval/interpreted_function.h> #include <vespa/eval/eval/nested_loop.h> +#include <vespa/vespalib/util/small_vector.h> namespace vespalib { class Stash; } namespace vespalib::eval { struct ValueBuilderFactory; } diff --git a/eval/src/vespa/eval/instruction/sparse_no_overlap_join_function.cpp b/eval/src/vespa/eval/instruction/sparse_no_overlap_join_function.cpp index f4808faadcc..8922e0da362 100644 --- a/eval/src/vespa/eval/instruction/sparse_no_overlap_join_function.cpp +++ b/eval/src/vespa/eval/instruction/sparse_no_overlap_join_function.cpp @@ -52,7 +52,7 @@ const Value &my_fast_no_overlap_sparse_join(const FastAddrMap &lhs_map, const Fa size_t addr_idx = store_rhs_idx[i]; output_addr[addr_idx] = r_addr[i]; } - result.add_mapping(ConstArrayRef(output_addr)); + result.add_mapping(output_addr); CT cell_value = fun(lhs_cells[lhs_subspace], rhs_cells[rhs_subspace]); result.my_cells.push_back_fast(cell_value); } @@ -109,7 +109,7 @@ SparseNoOverlapJoinFunction::compile_self(const ValueBuilderFactory &factory, St lhs().result_type(), rhs().result_type(), function(), factory); auto op = typify_invoke<2,MyTypify,SelectSparseNoOverlapJoinOp>(result_type().cell_meta().limit(), function()); - return InterpretedFunction::Instruction(op, wrap_param<JoinParam>(param)); + return {op, wrap_param<JoinParam>(param)}; } bool diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp index 123e2b7577d..47c1ec709fd 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_cluster.cpp @@ -23,6 +23,7 @@ #include <vespa/vespalib/util/stringfmt.h> #include <filesystem> #include <thread> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP(".bmcluster.bm_cluster"); diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index fbb17a43ee6..032307c1157 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -242,7 +242,7 @@ StoreOnlyDocSubDB::setupSummaryManager(SummaryManager::SP summaryManager) _rSummaryMgr = std::move(summaryManager); _iSummaryMgr = _rSummaryMgr; // Upcast allowed with std::shared_ptr _flushedDocumentStoreSerialNum = _iSummaryMgr->getBackingStore().lastSyncToken(); - _summaryAdapter.reset(new SummaryAdapter(_rSummaryMgr)); + _summaryAdapter = std::make_shared<SummaryAdapter>(_rSummaryMgr); } diff --git a/searchcore/src/vespa/searchcore/proton/server/summaryadapter.cpp b/searchcore/src/vespa/searchcore/proton/server/summaryadapter.cpp index 57786a5f788..038af801b80 100644 --- a/searchcore/src/vespa/searchcore/proton/server/summaryadapter.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/summaryadapter.cpp @@ -3,6 +3,7 @@ #include "summaryadapter.h" #include <vespa/searchcore/proton/docsummary/summarymanager.h> #include <vespa/vespalib/objects/nbostream.h> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP(".proton.server.summaryadapter"); @@ -11,12 +12,12 @@ using namespace document; namespace proton { -SummaryAdapter::SummaryAdapter(const SummaryManager::SP &mgr) - : _mgr(mgr), +SummaryAdapter::SummaryAdapter(SummaryManager::SP mgr) + : _mgr(std::move(mgr)), _lastSerial(_mgr->getBackingStore().lastSyncToken()) {} -SummaryAdapter::~SummaryAdapter() {} +SummaryAdapter::~SummaryAdapter() = default; bool SummaryAdapter::ignore(SerialNum serialNum) const { diff --git a/searchcore/src/vespa/searchcore/proton/server/summaryadapter.h b/searchcore/src/vespa/searchcore/proton/server/summaryadapter.h index 89b3827628c..0402d860577 100644 --- a/searchcore/src/vespa/searchcore/proton/server/summaryadapter.h +++ b/searchcore/src/vespa/searchcore/proton/server/summaryadapter.h @@ -17,8 +17,8 @@ private: ISummaryManager & imgr() const; public: - SummaryAdapter(const std::shared_ptr<SummaryManager> &mgr); - ~SummaryAdapter(); + explicit SummaryAdapter(std::shared_ptr<SummaryManager> mgr); + ~SummaryAdapter() override; void put(SerialNum serialNum, const DocumentIdT lid, const Document &doc) override; void put(SerialNum serialNum, const DocumentIdT lid, const vespalib::nbostream &doc) override; diff --git a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp index 8531ea66d38..4165d13d3fd 100644 --- a/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp +++ b/searchlib/src/vespa/searchlib/docstore/logdatastore.cpp @@ -11,6 +11,7 @@ #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/size_literals.h> #include <thread> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP(".searchlib.docstore.logdatastore"); diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index_loader.hpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index_loader.hpp index 11500c0b7f6..4fd75bb2fec 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index_loader.hpp +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index_loader.hpp @@ -5,6 +5,7 @@ #include "hnsw_index_loader.h" #include "hnsw_graph.h" #include <vespa/searchlib/util/fileutil.h> +#include <cassert> namespace search::tensor { @@ -18,7 +19,7 @@ HnswIndexLoader<ReaderType>::init() } template <typename ReaderType> -HnswIndexLoader<ReaderType>::~HnswIndexLoader() {} +HnswIndexLoader<ReaderType>::~HnswIndexLoader() = default; template <typename ReaderType> HnswIndexLoader<ReaderType>::HnswIndexLoader(HnswGraph& graph, std::unique_ptr<ReaderType> reader) diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index_saver.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index_saver.cpp index 8ac24d08dcf..29218b47f53 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index_saver.cpp +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index_saver.cpp @@ -4,6 +4,7 @@ #include "hnsw_graph.h" #include <vespa/searchlib/util/bufferwriter.h> #include <limits> +#include <cassert> namespace search::tensor { diff --git a/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.cpp b/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.cpp index 1dc0ff15e81..e267626fd7f 100644 --- a/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.cpp +++ b/storage/src/vespa/storage/distributor/maintenance/simplebucketprioritydatabase.cpp @@ -2,6 +2,7 @@ #include "simplebucketprioritydatabase.h" #include <vespa/vespalib/stllike/hash_map.hpp> +#include <cassert> #include <ostream> #include <sstream> diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h index 744e00674d6..e6627eb80e6 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h @@ -5,6 +5,7 @@ #include "i_unique_store_dictionary.h" #include "i_unique_store_dictionary_read_snapshot.h" #include <vespa/vespalib/stllike/allocator.h> +#include <cassert> namespace vespalib::datastore { diff --git a/vespalib/src/vespa/vespalib/util/arrayref.h b/vespalib/src/vespa/vespalib/util/arrayref.h index 88dc501370c..be4f4ef83f2 100644 --- a/vespalib/src/vespa/vespalib/util/arrayref.h +++ b/vespalib/src/vespa/vespalib/util/arrayref.h @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "small_vector.h" #include <vector> namespace vespalib { @@ -17,8 +16,6 @@ public: constexpr ArrayRef(T * v, size_t sz) noexcept : _v(v), _sz(sz) { } template<typename A=std::allocator<T>> ArrayRef(std::vector<T, A> & v) noexcept : _v(v.data()), _sz(v.size()) { } - template<size_t N> - ArrayRef(SmallVector<T, N> &v) noexcept : _v(v.data()), _sz(v.size()) { } T & operator [] (size_t i) noexcept { return _v[i]; } const T & operator [] (size_t i) const noexcept { return _v[i]; } T * data() noexcept { return _v; } @@ -38,8 +35,6 @@ public: constexpr ConstArrayRef(const T *v, size_t sz) noexcept : _v(v), _sz(sz) { } template<typename A=std::allocator<T>> ConstArrayRef(const std::vector<T, A> & v) noexcept : _v(v.data()), _sz(v.size()) { } - template<size_t N> - ConstArrayRef(const SmallVector<T, N> &v) noexcept : _v(v.data()), _sz(v.size()) { } ConstArrayRef(const ArrayRef<T> & v) noexcept : _v(v.data()), _sz(v.size()) { } constexpr ConstArrayRef() noexcept : _v(nullptr), _sz(0) {} const T & operator [] (size_t i) const noexcept { return _v[i]; } diff --git a/vespalib/src/vespa/vespalib/util/small_vector.h b/vespalib/src/vespa/vespalib/util/small_vector.h index 3e0e3cc7e4b..7df3913f376 100644 --- a/vespalib/src/vespa/vespalib/util/small_vector.h +++ b/vespalib/src/vespa/vespalib/util/small_vector.h @@ -4,6 +4,7 @@ #include "alloc.h" #include "traits.h" +#include "arrayref.h" #include <cstring> #include <cassert> #include <iterator> @@ -174,6 +175,7 @@ public: free(_data); } } + operator ConstArrayRef<T> () const { return ConstArrayRef<T>(data(), size()); } bool empty() const { return (_size == 0); } uint32_t size() const { return _size; } uint32_t capacity() const { return _capacity; } diff --git a/vespalib/src/vespa/vespalib/util/stash.h b/vespalib/src/vespa/vespalib/util/stash.h index 11731e69217..0d3558a26ab 100644 --- a/vespalib/src/vespa/vespalib/util/stash.h +++ b/vespalib/src/vespa/vespalib/util/stash.h @@ -6,6 +6,7 @@ #include "arrayref.h" #include "memoryusage.h" #include <cstdlib> +#include <memory> namespace vespalib { namespace stash { |