diff options
27 files changed, 64 insertions, 46 deletions
diff --git a/config/src/tests/failover/failover.cpp b/config/src/tests/failover/failover.cpp index 17fa264fd32..0ca09b228f3 100644 --- a/config/src/tests/failover/failover.cpp +++ b/config/src/tests/failover/failover.cpp @@ -7,6 +7,7 @@ #include <vespa/fnet/frt/frt.h> #include "config-my.h" #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/log/log.h> LOG_SETUP("failover"); diff --git a/config/src/tests/frt/frt.cpp b/config/src/tests/frt/frt.cpp index cf1ff9eca37..85b9789821d 100644 --- a/config/src/tests/frt/frt.cpp +++ b/config/src/tests/frt/frt.cpp @@ -10,6 +10,7 @@ #include <vespa/config/frt/frtconfigresponsev3.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/data/slime/json_format.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/fnet/fnet.h> #include <vespa/fnet/frt/frt.h> #include <vespa/fnet/frt/error.h> diff --git a/config/src/vespa/config/common/trace.cpp b/config/src/vespa/config/common/trace.cpp index 76310d08c7d..4edc9df60c3 100644 --- a/config/src/vespa/config/common/trace.cpp +++ b/config/src/vespa/config/common/trace.cpp @@ -3,6 +3,7 @@ #include <vespa/vespalib/trace/slime_trace_serializer.h> #include <vespa/vespalib/trace/slime_trace_deserializer.h> #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/data/simple_buffer.h> using namespace vespalib; using namespace vespalib::slime; diff --git a/config/src/vespa/config/frt/frtconfigresponsev3.cpp b/config/src/vespa/config/frt/frtconfigresponsev3.cpp index 405391d99b6..b983c63c6a5 100644 --- a/config/src/vespa/config/frt/frtconfigresponsev3.cpp +++ b/config/src/vespa/config/frt/frtconfigresponsev3.cpp @@ -2,6 +2,7 @@ #include "frtconfigresponsev3.h" #include "compressioninfo.h" #include <vespa/fnet/frt/frt.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/log/log.h> LOG_SETUP(".config.frt.frtconfigresponsev3"); diff --git a/config/src/vespa/config/frt/slimeconfigrequest.cpp b/config/src/vespa/config/frt/slimeconfigrequest.cpp index 07626c1e274..696789f74c1 100644 --- a/config/src/vespa/config/frt/slimeconfigrequest.cpp +++ b/config/src/vespa/config/frt/slimeconfigrequest.cpp @@ -7,6 +7,8 @@ #include <vespa/config/common/configdefinition.h> #include <vespa/config/common/trace.h> #include <vespa/config/common/vespa_version.h> +#include <vespa/vespalib/data/simple_buffer.h> + using namespace vespalib; using namespace vespalib::slime; diff --git a/config/src/vespa/config/print/fileconfigformatter.cpp b/config/src/vespa/config/print/fileconfigformatter.cpp index 85e938dee8f..628a9daa530 100644 --- a/config/src/vespa/config/print/fileconfigformatter.cpp +++ b/config/src/vespa/config/print/fileconfigformatter.cpp @@ -4,6 +4,7 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <cmath> #include <vector> diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp index 6407bb73ecb..47515d1bc4c 100644 --- a/metrics/src/tests/metricmanagertest.cpp +++ b/metrics/src/tests/metricmanagertest.cpp @@ -11,6 +11,7 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/xmlstream.h> #include <vespa/vespalib/util/time.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <thread> #include <vespa/log/log.h> diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 7d27c3b21f4..92117e174e9 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -31,6 +31,7 @@ #include <vespa/searchlib/transactionlog/nosyncproxy.h> #include <vespa/searchlib/transactionlog/translogserver.h> #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/vespalib/encoding/base64.h> #include <vespa/config-bucketspaces.h> #include <vespa/vespalib/testkit/testapp.h> diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp index 7cdd8d767c6..7e5e3527b1d 100644 --- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp @@ -6,6 +6,7 @@ #include <vespa/searchlib/util/rawbuf.h> #include <vespa/searchlib/util/slime_output_raw_buf_adapter.h> #include <vespa/vespalib/data/databuffer.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/vespalib/util/compressor.h> #include <vespa/searchsummary/docsummary/docsumwriter.h> #include <vespa/metrics/metricset.h> diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp index 5bb36f9c828..edc3b86d9d3 100644 --- a/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp +++ b/searchcore/src/vespa/searchcore/proton/summaryengine/docsum_by_slime.cpp @@ -20,7 +20,6 @@ using vespalib::Memory; using vespalib::slime::Symbol; using vespalib::slime::BinaryFormat; using vespalib::slime::ArrayTraverser; -using vespalib::SimpleBuffer; using vespalib::DataBuffer; using vespalib::ConstBufferRef; using vespalib::compression::CompressionConfig; diff --git a/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp b/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp index 9c896396de3..a5e0e1e2b6a 100644 --- a/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp +++ b/searchlib/src/tests/tensor/hnsw_index/stress_hnsw_mt.cpp @@ -1,9 +1,7 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <sys/types.h> -#include <sys/stat.h> #include <fcntl.h> -#include <stdio.h> +#include <cstdio> #include <unistd.h> #include <chrono> #include <cstdlib> @@ -24,6 +22,7 @@ #include <vespa/vespalib/util/blockingthreadstackexecutor.h> #include <vespa/vespalib/util/generationhandler.h> #include <vespa/vespalib/util/lambdatask.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/log/log.h> LOG_SETUP("stress_hnsw_mt"); diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp index cd53253ad0a..53f88246a0a 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.cpp @@ -112,13 +112,14 @@ ReferenceAttribute::buildReverseMapping(EntryRef newRef, const std::vector<Rever void ReferenceAttribute::buildReverseMapping() { - std::vector<std::pair<EntryRef, uint32_t>> indices; + using EntryPair = std::pair<EntryRef, uint32_t>; + std::vector<EntryPair, vespalib::allocator_large<EntryPair>> indices; uint32_t numDocs = _indices.size(); indices.reserve(numDocs); for (uint32_t lid = 0; lid < numDocs; ++lid) { EntryRef ref = _indices[lid]; if (ref.valid()) { - indices.push_back(std::make_pair(ref, lid)); + indices.emplace_back(ref, lid); } } std::sort(indices.begin(), indices.end()); @@ -200,8 +201,7 @@ ReferenceAttribute::onUpdateStat() std::unique_ptr<AttributeSaver> ReferenceAttribute::onInitSave(vespalib::stringref fileName) { - vespalib::GenerationHandler::Guard guard(this->getGenerationHandler(). - takeGuard()); + vespalib::GenerationHandler::Guard guard(this->getGenerationHandler().takeGuard()); return std::make_unique<ReferenceAttributeSaver> (std::move(guard), createAttributeHeader(fileName), @@ -221,8 +221,7 @@ ReferenceAttribute::onLoad() assert(attrReader.getEnumerated()); assert(!attrReader.hasIdx()); size_t numDocs(0); - uint64_t numValues(0); - numValues = attrReader.getEnumCount(); + uint64_t numValues = attrReader.getEnumCount(); numDocs = numValues; auto udatBuffer = attribute::LoadUtils::loadUDAT(*this); const GenericHeader &header = udatBuffer->getHeader(); @@ -367,13 +366,13 @@ class TargetLidPopulator : public IGidToLidMapperVisitor { ReferenceAttribute &_attr; public: - TargetLidPopulator(ReferenceAttribute &attr) + explicit TargetLidPopulator(ReferenceAttribute &attr) : IGidToLidMapperVisitor(), _attr(attr) { } - virtual ~TargetLidPopulator() override { } - virtual void visit(const document::GlobalId &gid, uint32_t lid) const override { + ~TargetLidPopulator() override = default; + void visit(const document::GlobalId &gid, uint32_t lid) const override { _attr.notifyReferencedPutNoCommit(gid, lid); } }; diff --git a/searchlib/src/vespa/searchlib/attribute/reference_attribute.h b/searchlib/src/vespa/searchlib/attribute/reference_attribute.h index 706abc53819..1c138abf989 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/reference_attribute.h @@ -7,6 +7,7 @@ #include "reference_mappings.h" #include <vespa/vespalib/datastore/unique_store.h> #include <vespa/vespalib/util/rcuvector.h> +#include <vespa/vespalib/stllike/allocator.h> namespace search { class IGidToLidMapperFactory; } @@ -28,7 +29,7 @@ public: using GlobalId = document::GlobalId; using ReferenceStore = vespalib::datastore::UniqueStore<Reference>; using ReferenceStoreIndices = vespalib::RcuVectorBase<EntryRef>; - using IndicesCopyVector = vespalib::Array<EntryRef>; + using IndicesCopyVector = std::vector<EntryRef, vespalib::allocator_large<EntryRef>>; // Class used to map from target lid to source lids using ReverseMapping = vespalib::btree::BTreeStore<uint32_t, vespalib::btree::BTreeNoLeafData, vespalib::btree::NoAggregated, @@ -45,14 +46,14 @@ private: std::shared_ptr<IGidToLidMapperFactory> _gidToLidMapperFactory; ReferenceMappings _referenceMappings; - virtual void onAddDocs(DocId docIdLimit) override; - virtual void removeOldGenerations(generation_t firstUsed) override; - virtual void onGenerationChange(generation_t generation) override; - virtual void onCommit() override; - virtual void onUpdateStat() override; - virtual std::unique_ptr<AttributeSaver> onInitSave(vespalib::stringref fileName) override; - virtual bool onLoad() override; - virtual uint64_t getUniqueValueCount() const override; + void onAddDocs(DocId docIdLimit) override; + void removeOldGenerations(generation_t firstUsed) override; + void onGenerationChange(generation_t generation) override; + void onCommit() override; + void onUpdateStat() override; + std::unique_ptr<AttributeSaver> onInitSave(vespalib::stringref fileName) override; + bool onLoad() override; + uint64_t getUniqueValueCount() const override; bool considerCompact(const CompactionStrategy &compactionStrategy); void compactWorst(); diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.h b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.h index 00645810d62..e8341901585 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.h +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectorfile.h @@ -6,6 +6,7 @@ #include <vespa/searchlib/common/bitvector.h> #include <vespa/searchlib/common/tunefileinfo.h> #include <vespa/vespalib/stllike/string.h> +#include <vespa/vespalib/stllike/allocator.h> #include "bitvectoridxfile.h" namespace search::diskindex { @@ -49,7 +50,7 @@ public: class BitVectorCandidate { private: - std::vector<uint32_t> _array; + std::vector<uint32_t, vespalib::allocator_large<uint32_t>> _array; uint64_t _numDocs; uint32_t _bitVectorLimit; BitVector::UP _bv; diff --git a/staging_vespalib/src/vespa/vespalib/net/generic_state_handler.cpp b/staging_vespalib/src/vespa/vespalib/net/generic_state_handler.cpp index a18c032fdff..b8fc432e95b 100644 --- a/staging_vespalib/src/vespa/vespalib/net/generic_state_handler.cpp +++ b/staging_vespalib/src/vespa/vespalib/net/generic_state_handler.cpp @@ -2,6 +2,7 @@ #include "generic_state_handler.h" #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/data/simple_buffer.h> namespace vespalib { diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp index dc8094275d1..a7d18b21516 100644 --- a/storage/src/tests/storageserver/statereportertest.cpp +++ b/storage/src/tests/storageserver/statereportertest.cpp @@ -10,8 +10,8 @@ #include <tests/common/dummystoragelink.h> #include <vespa/config/common/exceptions.h> #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/vespalib/gtest/gtest.h> -#include <vespa/vespalib/util/time.h> #include <thread> #include <vespa/log/log.h> diff --git a/vespalib/src/tests/slime/json_slime_benchmark.cpp b/vespalib/src/tests/slime/json_slime_benchmark.cpp index 3c006bb89f7..36987843492 100644 --- a/vespalib/src/tests/slime/json_slime_benchmark.cpp +++ b/vespalib/src/tests/slime/json_slime_benchmark.cpp @@ -1,9 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/vespalib/testkit/test_kit.h> #include <iostream> #include <fstream> -#include <sstream> using namespace vespalib::slime::convenience; diff --git a/vespalib/src/tests/slime/slime_binary_format_test.cpp b/vespalib/src/tests/slime/slime_binary_format_test.cpp index e6661cbf554..37ce6d5dfdf 100644 --- a/vespalib/src/tests/slime/slime_binary_format_test.cpp +++ b/vespalib/src/tests/slime/slime_binary_format_test.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/vespalib/data/slime/slime.h> +#include <vespa/vespalib/data/simple_buffer.h> #include "type_traits.h" #include <vespa/vespalib/util/stringfmt.h> diff --git a/vespalib/src/tests/slime/slime_json_format_test.cpp b/vespalib/src/tests/slime/slime_json_format_test.cpp index d1f77f09af1..df2f8b2e30b 100644 --- a/vespalib/src/tests/slime/slime_json_format_test.cpp +++ b/vespalib/src/tests/slime/slime_json_format_test.cpp @@ -3,6 +3,7 @@ #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/data/input.h> #include <vespa/vespalib/data/memory_input.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <iostream> #include <fstream> diff --git a/vespalib/src/tests/slime/slime_test.cpp b/vespalib/src/tests/slime/slime_test.cpp index 7e70dc3538e..e58b1599b8f 100644 --- a/vespalib/src/tests/slime/slime_test.cpp +++ b/vespalib/src/tests/slime/slime_test.cpp @@ -1,11 +1,14 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/log/log.h> -LOG_SETUP("slime_test"); + #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/data/slime/strfmt.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <type_traits> +#include <vespa/log/log.h> +LOG_SETUP("slime_test"); + using namespace vespalib::slime::convenience; TEST("print sizes") { diff --git a/vespalib/src/tests/trace/trace_serialization.cpp b/vespalib/src/tests/trace/trace_serialization.cpp index 7658fe7f163..3182e46061a 100644 --- a/vespalib/src/tests/trace/trace_serialization.cpp +++ b/vespalib/src/tests/trace/trace_serialization.cpp @@ -3,6 +3,7 @@ #include <vespa/vespalib/trace/tracenode.h> #include <vespa/vespalib/trace/slime_trace_serializer.h> #include <vespa/vespalib/trace/slime_trace_deserializer.h> +#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/log/log.h> LOG_SETUP("trace_test"); diff --git a/vespalib/src/vespa/vespalib/data/memory.h b/vespalib/src/vespa/vespalib/data/memory.h index 07767180b57..eee0a1a3e4f 100644 --- a/vespalib/src/vespa/vespalib/data/memory.h +++ b/vespalib/src/vespa/vespalib/data/memory.h @@ -15,14 +15,14 @@ struct Memory const char *data; size_t size; - Memory() : data(nullptr), size(0) {} - Memory(const char *d, size_t s) : data(d), size(s) {} - Memory(const char *str) : data(str), size(strlen(str)) {} - Memory(const std::string &str) + Memory() noexcept : data(nullptr), size(0) {} + Memory(const char *d, size_t s) noexcept : data(d), size(s) {} + Memory(const char *str) noexcept : data(str), size(strlen(str)) {} + Memory(const std::string &str) noexcept : data(str.data()), size(str.size()) {} - Memory(const vespalib::string &str) + Memory(const vespalib::string &str) noexcept : data(str.data()), size(str.size()) {} - Memory(vespalib::stringref str_ref) + Memory(vespalib::stringref str_ref) noexcept : data(str_ref.data()), size(str_ref.size()) {} vespalib::string make_string() const; vespalib::stringref make_stringref() const { return stringref(data, size); } diff --git a/vespalib/src/vespa/vespalib/data/simple_buffer.cpp b/vespalib/src/vespa/vespalib/data/simple_buffer.cpp index 09ac4a4b830..7e3c5022fc5 100644 --- a/vespalib/src/vespa/vespalib/data/simple_buffer.cpp +++ b/vespalib/src/vespa/vespalib/data/simple_buffer.cpp @@ -11,7 +11,7 @@ SimpleBuffer::SimpleBuffer() { } -SimpleBuffer::~SimpleBuffer() { } +SimpleBuffer::~SimpleBuffer() = default; Memory SimpleBuffer::obtain() diff --git a/vespalib/src/vespa/vespalib/data/simple_buffer.h b/vespalib/src/vespa/vespalib/data/simple_buffer.h index f7d9543440f..3bcb43a3856 100644 --- a/vespalib/src/vespa/vespalib/data/simple_buffer.h +++ b/vespalib/src/vespa/vespalib/data/simple_buffer.h @@ -4,6 +4,7 @@ #include "input.h" #include "output.h" +#include <vespa/vespalib/stllike/allocator.h> #include <iosfwd> #include <vector> @@ -20,7 +21,7 @@ class SimpleBuffer : public Input, public Output { private: - std::vector<char> _data; + std::vector<char, allocator_large<char>> _data; size_t _used; public: diff --git a/vespalib/src/vespa/vespalib/data/slime/slime.h b/vespalib/src/vespa/vespalib/data/slime/slime.h index aa44b38b353..6523cd1dac0 100644 --- a/vespalib/src/vespa/vespalib/data/slime/slime.h +++ b/vespalib/src/vespa/vespalib/data/slime/slime.h @@ -31,7 +31,6 @@ #include "external_data_value_factory.h" #include <vespa/vespalib/data/input_reader.h> #include <vespa/vespalib/data/output_writer.h> -#include <vespa/vespalib/data/simple_buffer.h> #include <vespa/vespalib/data/output.h> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h index db545451a30..78597a53dc8 100644 --- a/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h +++ b/vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h @@ -3,6 +3,7 @@ #pragma once #include "i_unique_store_dictionary.h" +#include <vespa/vespalib/stllike/allocator.h> namespace vespalib::datastore { @@ -18,9 +19,10 @@ template <typename RefT> class UniqueStoreEnumerator { public: using RefType = RefT; - using EnumValues = std::vector<std::vector<uint32_t>>; private: + using UInt32Vector = std::vector<uint32_t, vespalib::allocator_large<uint32_t>>; + using EnumValues = std::vector<UInt32Vector>; IUniqueStoreDictionary::ReadSnapshot::UP _dict_snapshot; const DataStoreBase &_store; EnumValues _enumValues; diff --git a/vespalib/src/vespa/vespalib/util/arrayref.h b/vespalib/src/vespa/vespalib/util/arrayref.h index 749395ff574..03634a7a094 100644 --- a/vespalib/src/vespa/vespalib/util/arrayref.h +++ b/vespalib/src/vespa/vespalib/util/arrayref.h @@ -13,11 +13,11 @@ namespace vespalib { template <typename T> class ArrayRef { public: - ArrayRef() : _v(nullptr), _sz(0) { } - ArrayRef(T * v, size_t sz) : _v(v), _sz(sz) { } + ArrayRef() noexcept : _v(nullptr), _sz(0) { } + ArrayRef(T * v, size_t sz) noexcept : _v(v), _sz(sz) { } template<typename A=std::allocator<T>> - ArrayRef(std::vector<T, A> & v) : _v(&v[0]), _sz(v.size()) { } - ArrayRef(Array<T> &v) : _v(&v[0]), _sz(v.size()) { } + ArrayRef(std::vector<T, A> & v) noexcept : _v(&v[0]), _sz(v.size()) { } + ArrayRef(Array<T> &v) noexcept : _v(&v[0]), _sz(v.size()) { } T & operator [] (size_t i) { return _v[i]; } const T & operator [] (size_t i) const { return _v[i]; } size_t size() const { return _sz; } @@ -32,12 +32,12 @@ private: template <typename T> class ConstArrayRef { public: - ConstArrayRef(const T *v, size_t sz) : _v(v), _sz(sz) { } + 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) : _v(&v[0]), _sz(v.size()) { } - ConstArrayRef(const ArrayRef<T> & v) : _v(&v[0]), _sz(v.size()) { } - ConstArrayRef(const Array<T> &v) : _v(&v[0]), _sz(v.size()) { } - ConstArrayRef() : _v(nullptr), _sz(0) {} + ConstArrayRef(const std::vector<T, A> & v) noexcept : _v(&v[0]), _sz(v.size()) { } + ConstArrayRef(const ArrayRef<T> & v) noexcept : _v(&v[0]), _sz(v.size()) { } + ConstArrayRef(const Array<T> &v) noexcept : _v(&v[0]), _sz(v.size()) { } + ConstArrayRef() noexcept : _v(nullptr), _sz(0) {} const T & operator [] (size_t i) const { return _v[i]; } size_t size() const { return _sz; } bool empty() const { return _sz == 0; } |