diff options
author | Neil <nyamatongwe@gmail.com> | 2020-07-16 19:55:15 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2020-07-16 19:55:15 +1000 |
commit | b3c9933350e5c6b9d06a72034e681cecae52dc4b (patch) | |
tree | a733fba3b608ba75f4c55ec27cc6026697fdd3b0 /lexlib/SparseState.h | |
parent | 08b502cac1f88bc511c324ab7eb23d34c4318bd7 (diff) | |
download | scintilla-mirror-b3c9933350e5c6b9d06a72034e681cecae52dc4b.tar.gz |
Add constexpr, const, noexcept and make other small improvements to lexlib.
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); } |