aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-09 11:13:47 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-03-09 11:13:47 +0000
commit16ab9df08e80af59e7ac51cd5d811e5358cde44f (patch)
treeef0482d34d45ded28a597df96d3add8e3036e9a8 /vespalib
parent1aeaf7c02af709e895c4fced8aceaa1be1165717 (diff)
Add noexcept.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/stllike/hashtable.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/vespalib/src/vespa/vespalib/stllike/hashtable.h b/vespalib/src/vespa/vespalib/stllike/hashtable.h
index af98ad0beb4..d6d28dabd49 100644
--- a/vespalib/src/vespa/vespalib/stllike/hashtable.h
+++ b/vespalib/src/vespa/vespalib/stllike/hashtable.h
@@ -102,15 +102,15 @@ class hash_node {
public:
using next_t=hashtable_base::next_t;
enum {npos=-1u, invalid=-2u};
- hash_node()
+ hash_node() noexcept
: _next(invalid)
{}
- hash_node(const V & node, next_t next=npos)
+ hash_node(const V & node, next_t next=npos) noexcept
: _next(next)
{
new (_node) V(node);
}
- hash_node(V &&node, next_t next=npos)
+ hash_node(V &&node, next_t next=npos) noexcept
: _next(next)
{
new (_node) V(std::move(node));
@@ -132,14 +132,14 @@ public:
}
return *this;
}
- hash_node(const hash_node & rhs)
+ hash_node(const hash_node & rhs) noexcept
: _next(rhs._next)
{
if (rhs.valid()) {
new (_node) V(rhs.getValue());
}
}
- hash_node &operator=(const hash_node & rhs) {
+ hash_node &operator=(const hash_node & rhs) noexcept {
destruct();
if (rhs.valid()) {
new (_node) V(rhs.getValue());
@@ -149,25 +149,25 @@ public:
}
return *this;
}
- ~hash_node() {
+ ~hash_node() noexcept {
destruct();
}
- bool operator == (const hash_node & rhs) const {
+ bool operator == (const hash_node & rhs) const noexcept {
return (_next == rhs._next) && (!valid() || (getValue() == rhs.getValue()));
}
- V & getValue() { return *reinterpret_cast<V *>(_node); }
- const V & getValue() const { return *reinterpret_cast<const V *>(_node); }
- next_t getNext() const { return _next; }
- void setNext(next_t next) { _next = next; }
- void invalidate() {
+ V & getValue() noexcept { return *reinterpret_cast<V *>(_node); }
+ const V & getValue() const noexcept { return *reinterpret_cast<const V *>(_node); }
+ next_t getNext() const noexcept { return _next; }
+ void setNext(next_t next) noexcept { _next = next; }
+ void invalidate() noexcept {
destruct();
_next = invalid;
}
- void terminate() { _next = npos; }
- bool valid() const { return _next != invalid; }
- bool hasNext() const { return valid() && (_next != npos); }
+ void terminate() noexcept { _next = npos; }
+ bool valid() const noexcept { return _next != invalid; }
+ bool hasNext() const noexcept { return valid() && (_next != npos); }
private:
- void destruct() {
+ void destruct() noexcept {
if constexpr (!can_skip_destruction<V>::value) {
if (valid()) {
getValue().~V();