diff options
author | mitchell <unknown> | 2020-07-19 19:58:28 -0400 |
---|---|---|
committer | mitchell <unknown> | 2020-07-19 19:58:28 -0400 |
commit | cf3c77c09d71cd4b1ebf8e7fe05a9485d182387e (patch) | |
tree | 1e0ff0b323889d275fea6c1c79258fc4a2a39942 /lexlib/SparseState.h | |
parent | 834c5671ca91a6fa80c945fa2fe0d750b6cc7dff (diff) | |
download | scintilla-mirror-cf3c77c09d71cd4b1ebf8e7fe05a9485d182387e.tar.gz |
Backport: Add constexpr, const, noexcept and make other small improvements to lexlib.
Backport of changeset 8416:06a43e06a8e0.
Diffstat (limited to 'lexlib/SparseState.h')
-rw-r--r-- | lexlib/SparseState.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lexlib/SparseState.h b/lexlib/SparseState.h index 4e7ac92e3..6286c76af 100644 --- a/lexlib/SparseState.h +++ b/lexlib/SparseState.h @@ -17,12 +17,12 @@ class SparseState { struct State { Sci_Position position; T value; - State(Sci_Position position_, T value_) : position(position_), value(value_) { + constexpr State(Sci_Position position_, T value_) noexcept : position(position_), value(value_) { } - inline bool operator<(const State &other) const { + inline bool operator<(const State &other) const noexcept { return position < other.position; } - inline bool operator==(const State &other) const { + inline bool operator==(const State &other) const noexcept { return (position == other.position) && (value == other.value); } }; @@ -31,7 +31,7 @@ class SparseState { stateVector states; typename stateVector::iterator Find(Sci_Position position) { - State searchValue(position, T()); + const State searchValue(position, T()); return std::lower_bound(states.begin(), states.end(), searchValue); } |