From a30c7a396d0ec76c34c8c4638d5b7fb78724a9ad Mon Sep 17 00:00:00 2001 From: Ioan Chera Date: Tue, 17 Oct 2023 08:14:37 +0300 Subject: [PATCH] Added noexcept --- src/Document.h | 4 ++-- src/m_strings.cc | 2 +- src/m_strings.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Document.h b/src/Document.h index 7928dc11f..64908bb38 100644 --- a/src/Document.h +++ b/src/Document.h @@ -76,7 +76,7 @@ struct Document { return static_cast(vertices.size()); } - int numSectors() const + int numSectors() const noexcept { return static_cast(sectors.size()); } @@ -96,7 +96,7 @@ struct Document { return n >= 0 && n < numVertices(); } - bool isSector(int n) const + bool isSector(int n) const noexcept { return n >= 0 && n < numSectors(); } diff --git a/src/m_strings.cc b/src/m_strings.cc index 20134c564..aad216d31 100644 --- a/src/m_strings.cc +++ b/src/m_strings.cc @@ -408,7 +408,7 @@ StringID StringTable::add(const SString &text) // // Get a text (handle it robustly) // -SString StringTable::get(StringID offset) const +SString StringTable::get(StringID offset) const noexcept { // this should never happen // [ but handle it gracefully, for the sake of robustness ] diff --git a/src/m_strings.h b/src/m_strings.h index 2ef446c2a..465af4d6d 100644 --- a/src/m_strings.h +++ b/src/m_strings.h @@ -438,7 +438,7 @@ class StringID explicit StringID(int num) : num(num) { } - int get() const + int get() const noexcept { return num; } @@ -458,7 +458,7 @@ class StringID { return num >= 0; } - bool isInvalid() const + bool isInvalid() const noexcept { return num < 0; } @@ -479,7 +479,7 @@ class StringTable { public: StringID add(const SString &str); - SString get(StringID offset) const; + SString get(StringID offset) const noexcept; private: // Must start with an empty string, so get(0) gets "". std::vector mStrings = { "" };