Skip to content

Commit

Permalink
Added noexcept
Browse files Browse the repository at this point in the history
  • Loading branch information
ioan-chera committed Oct 17, 2023
1 parent 8b3c8ea commit a30c7a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct Document
{
return static_cast<int>(vertices.size());
}
int numSectors() const
int numSectors() const noexcept
{
return static_cast<int>(sectors.size());
}
Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/m_strings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down
6 changes: 3 additions & 3 deletions src/m_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ class StringID
explicit StringID(int num) : num(num)
{
}
int get() const
int get() const noexcept
{
return num;
}
Expand All @@ -458,7 +458,7 @@ class StringID
{
return num >= 0;
}
bool isInvalid() const
bool isInvalid() const noexcept
{
return num < 0;
}
Expand All @@ -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<SString> mStrings = { "" };
Expand Down

0 comments on commit a30c7a3

Please sign in to comment.