diff options
author | Max Kellermann <max@musicpd.org> | 2017-11-26 12:23:46 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-11-26 12:23:46 +0100 |
commit | 0691ecc0520253179c24bdfd146ee9973217ccb1 (patch) | |
tree | 7e7ce6ee43a993a4b87fd8f2fba4316ca8dd841e /src/queue | |
parent | d917f44b5b9f75102f2c12208b08c9d3395df982 (diff) |
queue/IdTable: add "noexcept"
Diffstat (limited to 'src/queue')
-rw-r--r-- | src/queue/IdTable.hxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/queue/IdTable.hxx b/src/queue/IdTable.hxx index 1b4ba16ac..bcc1b0ea7 100644 --- a/src/queue/IdTable.hxx +++ b/src/queue/IdTable.hxx @@ -37,21 +37,22 @@ class IdTable { int *data; public: - IdTable(unsigned _size):size(_size), next(1), data(new int[size]) { + IdTable(unsigned _size) noexcept + :size(_size), next(1), data(new int[size]) { std::fill_n(data, size, -1); } - ~IdTable() { + ~IdTable() noexcept { delete[] data; } - int IdToPosition(unsigned id) const { + int IdToPosition(unsigned id) const noexcept { return id < size ? data[id] : -1; } - unsigned GenerateId() { + unsigned GenerateId() noexcept { assert(next > 0); assert(next < size); @@ -67,20 +68,20 @@ public: } } - unsigned Insert(unsigned position) { + unsigned Insert(unsigned position) noexcept { unsigned id = GenerateId(); data[id] = position; return id; } - void Move(unsigned id, unsigned position) { + void Move(unsigned id, unsigned position) noexcept { assert(id < size); assert(data[id] >= 0); data[id] = position; } - void Erase(unsigned id) { + void Erase(unsigned id) noexcept { assert(id < size); assert(data[id] >= 0); |