summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-09-19 11:16:47 +0200
committerGitHub <noreply@github.com>2022-09-19 11:16:47 +0200
commitf1828ccdfb54e6dcc167a488d9185f171754a654 (patch)
tree5d6217b8662d53f828498ecc254d60a35c35dd7d /vespalib
parent6d350b26677b5d3007b85f1efe288a417164d328 (diff)
parentcefbaa26062e228262a39110ecabf7b031c69100 (diff)
Merge pull request #24102 from vespa-engine/balder/avoid-pulling-in-small-vector-everywhere
Avoid including smallvector in arrayref, then it is included 'everywh…
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_enumerator.h1
-rw-r--r--vespalib/src/vespa/vespalib/util/arrayref.h5
-rw-r--r--vespalib/src/vespa/vespalib/util/small_vector.h2
-rw-r--r--vespalib/src/vespa/vespalib/util/stash.h1
4 files changed, 4 insertions, 5 deletions
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 {