diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-04-07 10:29:01 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-04-07 10:29:01 +0000 |
commit | 66e3e6aa09fb5f8f0fadb7e3374cc0a3142c8183 (patch) | |
tree | c9433e4d7cad983a8cf3712a3b85d6282e165b7d | |
parent | d891e8132b8d62ff5140da5eaf50744a24868c35 (diff) |
Make move constructors noexcept and move them to implementation file.
-rw-r--r-- | document/src/vespa/document/fieldvalue/variablemap.cpp | 16 | ||||
-rw-r--r-- | document/src/vespa/document/fieldvalue/variablemap.h | 8 |
2 files changed, 14 insertions, 10 deletions
diff --git a/document/src/vespa/document/fieldvalue/variablemap.cpp b/document/src/vespa/document/fieldvalue/variablemap.cpp index 655b156fe30..1ad4e1b716b 100644 --- a/document/src/vespa/document/fieldvalue/variablemap.cpp +++ b/document/src/vespa/document/fieldvalue/variablemap.cpp @@ -22,28 +22,32 @@ IndexValue::operator==(const IndexValue& other) const { } IndexValue::IndexValue(const FieldValue& key_) - : index(-1), - key(FieldValue::CP(key_.clone())) + : index(-1), + key(key_.clone()) { } +IndexValue::IndexValue(IndexValue && rhs) noexcept = default; +IndexValue & IndexValue::operator = (IndexValue && rhs) noexcept = default; IndexValue::IndexValue(const IndexValue & rhs) = default; IndexValue & IndexValue::operator = (const IndexValue & rhs) = default; -IndexValue::~IndexValue() { } +IndexValue::~IndexValue() = default; vespalib::string IndexValue::toString() const { - if (key.get() != NULL) { + if (key) { return key->toString(); } else { return vespalib::make_string("%d", index); } } -VariableMap::VariableMap() {} -VariableMap::~VariableMap() {} +VariableMap::VariableMap(VariableMap && rhs) noexcept = default; +VariableMap & VariableMap::operator = (VariableMap && rhs) noexcept = default; VariableMap::VariableMap(const VariableMap & rhs) = default; VariableMap & VariableMap::operator = (const VariableMap & rhs) = default; +VariableMap::VariableMap() = default; +VariableMap::~VariableMap() = default; vespalib::string VariableMap::toString() const { diff --git a/document/src/vespa/document/fieldvalue/variablemap.h b/document/src/vespa/document/fieldvalue/variablemap.h index 70dba1551ef..68b8bcf09e8 100644 --- a/document/src/vespa/document/fieldvalue/variablemap.h +++ b/document/src/vespa/document/fieldvalue/variablemap.h @@ -17,8 +17,8 @@ public: IndexValue(); IndexValue(int index_); IndexValue(const FieldValue& key_); - IndexValue(IndexValue && rhs) = default; - IndexValue & operator = (IndexValue && rhs) = default; + IndexValue(IndexValue && rhs) noexcept; + IndexValue & operator = (IndexValue && rhs) noexcept; IndexValue(const IndexValue & rhs); IndexValue & operator = (const IndexValue & rhs); @@ -36,8 +36,8 @@ using VariableMapT = std::map<vespalib::string, IndexValue>; class VariableMap : public VariableMapT { public: VariableMap(); - VariableMap(VariableMap && rhs) = default; - VariableMap & operator = (VariableMap && rhs) = default; + VariableMap(VariableMap && rhs) noexcept; + VariableMap & operator = (VariableMap && rhs) noexcept; VariableMap(const VariableMap & rhs); VariableMap & operator = (const VariableMap & rhs); ~VariableMap(); |