aboutsummaryrefslogtreecommitdiffstats
path: root/document/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-04-07 10:58:48 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-04-07 10:58:48 +0000
commit88e5f78b00b6b2fa1d75ba5d0964430e8c66c760 (patch)
tree02f2d8b68724289b91973827a86f0869ce60bf23 /document/src
parent81dffb3763833946bb3997703c06a00d364aaaf8 (diff)
Move when you can
Diffstat (limited to 'document/src')
-rw-r--r--document/src/vespa/document/select/resultlist.cpp11
-rw-r--r--document/src/vespa/document/select/resultlist.h8
-rw-r--r--document/src/vespa/document/select/valuenodes.cpp2
3 files changed, 12 insertions, 9 deletions
diff --git a/document/src/vespa/document/select/resultlist.cpp b/document/src/vespa/document/select/resultlist.cpp
index e72eb36cbdb..5bb2f510e0d 100644
--- a/document/src/vespa/document/select/resultlist.cpp
+++ b/document/src/vespa/document/select/resultlist.cpp
@@ -7,7 +7,8 @@
namespace document::select {
ResultList::ResultList() = default;
-
+ResultList::ResultList(ResultList &&) noexcept = default;
+ResultList & ResultList::operator = (ResultList &&) noexcept = default;
ResultList::~ResultList() = default;
ResultList::ResultList(const Result& result) {
@@ -15,9 +16,9 @@ ResultList::ResultList(const Result& result) {
}
void
-ResultList::add(const fieldvalue::VariableMap& variables, const Result& result)
+ResultList::add(fieldvalue::VariableMap variables, const Result& result)
{
- _results.push_back(ResultPair(variables, &result));
+ _results.emplace_back(std::move(variables), &result);
}
void
@@ -109,7 +110,7 @@ ResultList::operator&&(const ResultList& other) const
if (vars.empty()) {
resultForNoVariables.set(result.toEnum());
} else {
- results.add(vars, result);
+ results.add(std::move(vars), result);
}
}
}
@@ -137,7 +138,7 @@ ResultList::operator||(const ResultList& other) const
if (vars.empty()) {
resultForNoVariables.set(result.toEnum());
} else {
- results.add(vars, result);
+ results.add(std::move(vars), result);
}
}
}
diff --git a/document/src/vespa/document/select/resultlist.h b/document/src/vespa/document/select/resultlist.h
index b59a4f1a904..3f810004168 100644
--- a/document/src/vespa/document/select/resultlist.h
+++ b/document/src/vespa/document/select/resultlist.h
@@ -17,8 +17,10 @@ public:
using const_reverse_iterator = Results::const_reverse_iterator;
ResultList();
- ResultList(ResultList &&) = default;
- ResultList & operator = (ResultList &&) = default;
+ ResultList(ResultList &&) noexcept;
+ ResultList & operator = (ResultList &&) noexcept;
+ ResultList(const ResultList &) = delete;
+ ResultList & operator = (const ResultList &) = delete;
~ResultList();
/**
@@ -26,7 +28,7 @@ public:
*/
explicit ResultList(const Result& result);
- void add(const VariableMap& variables, const Result& result);
+ void add(VariableMap variables, const Result& result);
ResultList operator&&(const ResultList& other) const;
ResultList operator||(const ResultList& other) const;
diff --git a/document/src/vespa/document/select/valuenodes.cpp b/document/src/vespa/document/select/valuenodes.cpp
index 2a9604e7f43..c770974adfe 100644
--- a/document/src/vespa/document/select/valuenodes.cpp
+++ b/document/src/vespa/document/select/valuenodes.cpp
@@ -263,7 +263,7 @@ IteratorHandler::onPrimitive(uint32_t fid, const Content& fv) {
if (!_firstValue && getVariables().empty()) {
_firstValue = getInternalValue(fv.getValue());
} else {
- _values.emplace_back(getVariables(), Value::SP(getInternalValue(fv.getValue()).release()));
+ _values.emplace_back(std::move(getVariables()), Value::SP(getInternalValue(fv.getValue()).release()));
}
}