diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-26 17:50:18 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-26 17:50:18 +0000 |
commit | 0acc3577c746805516323c5dd77f0fd5d4f8777b (patch) | |
tree | ca37d31857c79f2d693de8173f012d0cd3384d0b /vdslib | |
parent | a2d4e3411d4173be5767750d4e71081d54bba9b6 (diff) |
Add noexcept
Diffstat (limited to 'vdslib')
-rw-r--r-- | vdslib/src/vespa/vdslib/state/nodetype.cpp | 4 | ||||
-rw-r--r-- | vdslib/src/vespa/vdslib/state/nodetype.h | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/vdslib/src/vespa/vdslib/state/nodetype.cpp b/vdslib/src/vespa/vdslib/state/nodetype.cpp index 97e15625186..7a52dbf6116 100644 --- a/vdslib/src/vespa/vdslib/state/nodetype.cpp +++ b/vdslib/src/vespa/vdslib/state/nodetype.cpp @@ -27,7 +27,7 @@ NodeType::get(vespalib::stringref serialized) } const NodeType& -NodeType::get(Type type) +NodeType::get(Type type) noexcept { switch (type) { case Type::STORAGE: @@ -40,7 +40,7 @@ NodeType::get(Type type) abort(); } -NodeType::NodeType(vespalib::stringref name, Type type) +NodeType::NodeType(vespalib::stringref name, Type type) noexcept : _type(type), _name(name) { } diff --git a/vdslib/src/vespa/vdslib/state/nodetype.h b/vdslib/src/vespa/vdslib/state/nodetype.h index abf1c5709b6..86d683384e6 100644 --- a/vdslib/src/vespa/vdslib/state/nodetype.h +++ b/vdslib/src/vespa/vdslib/state/nodetype.h @@ -29,24 +29,24 @@ public: /** Throws vespalib::IllegalArgumentException if invalid state given. */ static const NodeType& get(vespalib::stringref serialized); - static const NodeType& get(Type type); - const vespalib::string& serialize() const { return _name; } + static const NodeType& get(Type type) noexcept; + const vespalib::string& serialize() const noexcept { return _name; } - Type getType() const { return _type; } - operator uint16_t() const { return static_cast<uint16_t>(_type); } + Type getType() const noexcept { return _type; } + operator uint16_t() const noexcept { return static_cast<uint16_t>(_type); } - const vespalib::string & toString() const { return _name; } - bool operator==(const NodeType& other) const { return (&other == this); } - bool operator!=(const NodeType& other) const { return (&other != this); } + const vespalib::string & toString() const noexcept { return _name; } + bool operator==(const NodeType& other) const noexcept { return (&other == this); } + bool operator!=(const NodeType& other) const noexcept { return (&other != this); } - bool operator<(const NodeType& other) const { + bool operator<(const NodeType& other) const noexcept { return (&other == this ? false : *this == NodeType::DISTRIBUTOR); } private: Type _type; vespalib::string _name; - NodeType(vespalib::stringref name, Type type); + NodeType(vespalib::stringref name, Type type) noexcept; }; std::ostream & operator << (std::ostream & os, const NodeType & n); |