aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-03-14 16:08:22 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-03-14 16:24:03 +0000
commit992e6a6bbe7fb7ae5d122c65c07843655a78cb57 (patch)
tree388716daa313ac58eec25b613a8cffef78eae268 /vespalib
parentd7ade13fee737d8b214bb87c164684fdfcb6970f (diff)
Prefer std::vector
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/objects/nbostream/nbostream_test.cpp10
-rw-r--r--vespalib/src/vespa/vespalib/objects/deserializer.h5
-rw-r--r--vespalib/src/vespa/vespalib/objects/deserializer.hpp12
-rw-r--r--vespalib/src/vespa/vespalib/objects/nbostream.h21
-rw-r--r--vespalib/src/vespa/vespalib/objects/serializer.h4
-rw-r--r--vespalib/src/vespa/vespalib/objects/serializer.hpp10
-rw-r--r--vespalib/src/vespa/vespalib/objects/visit.hpp4
7 files changed, 2 insertions, 64 deletions
diff --git a/vespalib/src/tests/objects/nbostream/nbostream_test.cpp b/vespalib/src/tests/objects/nbostream/nbostream_test.cpp
index 5d7f5c0504b..20ea2bf5aaa 100644
--- a/vespalib/src/tests/objects/nbostream/nbostream_test.cpp
+++ b/vespalib/src/tests/objects/nbostream/nbostream_test.cpp
@@ -216,16 +216,6 @@ TEST_F("Test serializing vespalib::string", Fixture)
f.assertSerialize(exp, val);
}
-TEST_F("Test serializing vespalib::Array", Fixture)
-{
- vespalib::Array<int16_t> val;
- val.resize(2);
- val[0] = 0x0123;
- val[1] = 0x4567;
- ExpBuffer exp({ 0x00, 0x00, 0x00, 0x02, 0x01, 0x23, 0x45, 0x67 });
- f.assertSerialize(exp, val);
-}
-
TEST_F("Test serializing std::vector", Fixture)
{
std::vector<int16_t> val({ 0x0123, 0x4567 });
diff --git a/vespalib/src/vespa/vespalib/objects/deserializer.h b/vespalib/src/vespa/vespalib/objects/deserializer.h
index e59d3e07581..dcb1b5176cb 100644
--- a/vespalib/src/vespa/vespalib/objects/deserializer.h
+++ b/vespalib/src/vespa/vespalib/objects/deserializer.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 <vespa/vespalib/util/array.h>
#include <vespa/vespalib/stllike/string.h>
#include <vector>
#include <cstdint>
@@ -44,11 +43,7 @@ public:
Deserializer & operator >> (double & value) { return get(value); }
Deserializer & operator >> (string & value) { return get(value); }
template <typename T>
- Deserializer & operator >> (vespalib::Array<T> & v);
- template <typename T>
Deserializer & operator >> (std::vector<T> & v);
-
};
}
-
diff --git a/vespalib/src/vespa/vespalib/objects/deserializer.hpp b/vespalib/src/vespa/vespalib/objects/deserializer.hpp
index b90867fa153..cf9bd5b0a48 100644
--- a/vespalib/src/vespa/vespalib/objects/deserializer.hpp
+++ b/vespalib/src/vespa/vespalib/objects/deserializer.hpp
@@ -7,18 +7,6 @@ namespace vespalib {
template <typename T>
Deserializer &
-Deserializer::operator >> (vespalib::Array<T> & v) {
- uint32_t sz;
- get(sz);
- v.resize(sz);
- for(size_t i(0); i < sz; i++) {
- (*this) >> v[i];
- }
- return *this;
-}
-
-template <typename T>
-Deserializer &
Deserializer::operator >> (std::vector<T> & v) {
uint32_t sz;
get(sz);
diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.h b/vespalib/src/vespa/vespalib/objects/nbostream.h
index 12d4fac04cc..bf2adc7b486 100644
--- a/vespalib/src/vespa/vespalib/objects/nbostream.h
+++ b/vespalib/src/vespa/vespalib/objects/nbostream.h
@@ -87,25 +87,6 @@ public:
return *this;
}
template <typename T>
- nbostream & operator << (const vespalib::Array<T> & v) {
- uint32_t sz(v.size());
- (*this) << sz;
- for(size_t i(0); i < sz; i++) {
- (*this) << v[i];
- }
- return *this;
- }
- template <typename T>
- nbostream & operator >> (vespalib::Array<T> & v) {
- uint32_t sz;
- (*this) >> sz;
- v.resize(sz);
- for(size_t i(0); i < sz; i++) {
- (*this) >> v[i];
- }
- return *this;
- }
- template <typename T>
nbostream & operator << (const std::vector<T> & v) {
uint32_t sz(v.size());
(*this) << sz;
@@ -175,8 +156,6 @@ public:
}
void swap(Buffer & buf);
void swap(nbostream & os);
- /** extract the underlying Array<char>; nbostream will be empty afterwards. */
- Buffer extract_buffer() { Buffer rv; swap(rv); return rv; }
/**
* This flag can be used to tell that a buffer will live at least as long as
* any objects it will be the backing for. In those cases there is no need for
diff --git a/vespalib/src/vespa/vespalib/objects/serializer.h b/vespalib/src/vespa/vespalib/objects/serializer.h
index f10d03b1c04..f8a43ab104a 100644
--- a/vespalib/src/vespa/vespalib/objects/serializer.h
+++ b/vespalib/src/vespa/vespalib/objects/serializer.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 <vespa/vespalib/util/array.h>
#include <vespa/vespalib/stllike/string.h>
#include <vector>
#include <cstdint>
@@ -42,10 +41,7 @@ public:
Serializer & operator << (double value) { return put(value); }
Serializer & operator << (stringref value) { return put(value); }
template <typename T>
- Serializer & operator << (const vespalib::Array<T> & v);
- template <typename T>
Serializer & operator << (const std::vector<T> & v);
};
}
-
diff --git a/vespalib/src/vespa/vespalib/objects/serializer.hpp b/vespalib/src/vespa/vespalib/objects/serializer.hpp
index 87c02ddf693..1962ddd4359 100644
--- a/vespalib/src/vespa/vespalib/objects/serializer.hpp
+++ b/vespalib/src/vespa/vespalib/objects/serializer.hpp
@@ -9,16 +9,6 @@ namespace vespalib {
template <typename T>
Serializer &
-Serializer::operator << (const vespalib::Array<T> & v) {
- uint32_t sz(v.size());
- put(sz);
- for(size_t i(0); i < sz; i++) {
- (*this) << v[i];
- }
- return *this;
-}
-template <typename T>
-Serializer &
Serializer::operator << (const std::vector<T> & v) {
uint32_t sz(v.size());
put(sz);
diff --git a/vespalib/src/vespa/vespalib/objects/visit.hpp b/vespalib/src/vespa/vespalib/objects/visit.hpp
index e3a82b212c0..9838e331823 100644
--- a/vespalib/src/vespa/vespalib/objects/visit.hpp
+++ b/vespalib/src/vespa/vespalib/objects/visit.hpp
@@ -2,9 +2,9 @@
#pragma once
#include "visit.h"
-#include <vector>
-#include <vespa/vespalib/util/stringfmt.h>
#include "objectvisitor.h"
+#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/vespalib/util/array.h>
#include "identifiable.hpp"
template<typename T>