From 0691ecc0520253179c24bdfd146ee9973217ccb1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 26 Nov 2017 12:23:46 +0100 Subject: [PATCH] queue/IdTable: add "noexcept" --- src/queue/IdTable.hxx | 15 ++++++++------- 1 file 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);