diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-06 21:25:06 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-06 21:34:26 +0000 |
commit | 7ef38647f60cf0e6750bbddaacd09aa8f279d77d (patch) | |
tree | cb1cbe25af89221588f22db4ef3f804cecd6c26c /document | |
parent | 1c3d83a0499b854887e8a998cc33dd1101519738 (diff) |
Use noexcept as advise by gcc -Wnoexcept
Diffstat (limited to 'document')
-rw-r--r-- | document/src/vespa/document/base/field.h | 6 | ||||
-rw-r--r-- | document/src/vespa/document/base/globalid.h | 8 | ||||
-rw-r--r-- | document/src/vespa/document/bucket/bucketspace.h | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/document/src/vespa/document/base/field.h b/document/src/vespa/document/base/field.h index 305021ef29a..613fcd9df1b 100644 --- a/document/src/vespa/document/base/field.h +++ b/document/src/vespa/document/base/field.h @@ -91,9 +91,9 @@ public: std::unique_ptr<FieldValue> createValue() const; // Note that only id is checked for equality. - bool operator==(const Field & other) const { return (_fieldId == other._fieldId); } - bool operator!=(const Field & other) const { return (_fieldId != other._fieldId); } - bool operator<(const Field & other) const { return (getName() < other.getName()); } + bool operator==(const Field & other) const noexcept { return (_fieldId == other._fieldId); } + bool operator!=(const Field & other) const noexcept { return (_fieldId != other._fieldId); } + bool operator<(const Field & other) const noexcept { return (getName() < other.getName()); } const DataType &getDataType() const { return *_dataType; } diff --git a/document/src/vespa/document/base/globalid.h b/document/src/vespa/document/base/globalid.h index 391ed3a892a..1bb257b7cbf 100644 --- a/document/src/vespa/document/base/globalid.h +++ b/document/src/vespa/document/base/globalid.h @@ -89,7 +89,7 @@ public: */ explicit GlobalId(const void *gid) noexcept { set(gid); } - GlobalId(const GlobalId &rhs) = default; + GlobalId(const GlobalId &rhs) noexcept = default; /** * Implements the assignment operator. @@ -105,7 +105,7 @@ public: * @param other The global id to compare to. * @return True if this equals the other, false otherwise. */ - bool operator==(const GlobalId& other) const { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) == 0); } + bool operator==(const GlobalId& other) const noexcept { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) == 0); } /** * Implements the inequality operator. @@ -113,7 +113,7 @@ public: * @param other The global id to compare to. * @return True if this does NOT equal the other, false otherwise. */ - bool operator!=(const GlobalId& other) const { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) != 0); } + bool operator!=(const GlobalId& other) const noexcept { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) != 0); } /** * Implements the less-than operator. If you intend to map global ids in such a way that they can @@ -123,7 +123,7 @@ public: * @param other The global id to compare to. * @return True if comparing the bits of this to the other yields a negative result. */ - bool operator<(const GlobalId& other) const { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) < 0); } + bool operator<(const GlobalId& other) const noexcept { return (memcmp(_gid._buffer, other._gid._buffer, sizeof(_gid._buffer)) < 0); } /** * Copies the first LENGTH bytes from the given address into the internal byte array. diff --git a/document/src/vespa/document/bucket/bucketspace.h b/document/src/vespa/document/bucket/bucketspace.h index 99b510f7aff..ab9080efd78 100644 --- a/document/src/vespa/document/bucket/bucketspace.h +++ b/document/src/vespa/document/bucket/bucketspace.h @@ -29,7 +29,7 @@ public: vespalib::string toString() const; struct hash { - size_t operator () (const BucketSpace& bs) const { + size_t operator () (const BucketSpace& bs) const noexcept { return std::hash<Type>()(bs.getId()); } }; |