summaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-10-07 11:16:08 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-10-07 11:16:35 +0000
commit9bb9d8e14827ecc4dba2d43e2d9e76248c120e1d (patch)
tree9e64c1471c0391410c824f75e2dc1fbfa8585229 /vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
parentf2e89d3361cae0e2e74bac89405a175d6ecf5e98 (diff)
Add noexcept as indicated by -Wnoeexcept
Diffstat (limited to 'vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp')
-rw-r--r--vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
index 72a0c93c719..faee7680426 100644
--- a/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
+++ b/vespalib/src/tests/stllike/uniq_by_sort_map_hash.cpp
@@ -71,13 +71,13 @@ class Gid
{
public:
struct hash {
- size_t operator () (const Gid & g) const { return g.getGid()[0]; }
+ size_t operator () (const Gid & g) const noexcept { return g.getGid()[0]; }
};
- Gid(unsigned int v=0) : _gid() { _gid[0] = _gid[1] = _gid[2] = v; }
+ Gid(unsigned int v=0) noexcept : _gid() { _gid[0] = _gid[1] = _gid[2] = v; }
const unsigned int * getGid() const { return _gid; }
- int cmp(const Gid & b) const { return memcmp(_gid, b._gid, sizeof(_gid)); }
- bool operator < (const Gid & b) const { return cmp(b) < 0; }
- bool operator == (const Gid & b) const { return cmp(b) == 0; }
+ int cmp(const Gid & b) const noexcept { return memcmp(_gid, b._gid, sizeof(_gid)); }
+ bool operator < (const Gid & b) const noexcept { return cmp(b) < 0; }
+ bool operator == (const Gid & b) const noexcept { return cmp(b) == 0; }
private:
unsigned int _gid[3];
};
@@ -85,15 +85,15 @@ private:
class Slot
{
public:
- Slot(unsigned int v=0) : _gid(v) { }
+ Slot(unsigned int v=0) noexcept : _gid(v) { }
const Gid & getGid() const { return _gid; }
- int cmp(const Slot & b) const { return _gid.cmp(b.getGid()); }
+ int cmp(const Slot & b) const noexcept { return _gid.cmp(b.getGid()); }
private:
Gid _gid;
};
struct IndirectCmp : public std::binary_function<Slot*, Slot*, bool> {
- bool operator()(const Slot* s1, const Slot* s2) {
+ bool operator() (const Slot* s1, const Slot* s2) noexcept {
return s1->cmp(*s2) < 0;
}
};