From cf3c77c09d71cd4b1ebf8e7fe05a9485d182387e Mon Sep 17 00:00:00 2001 From: mitchell Date: Sun, 19 Jul 2020 19:58:28 -0400 Subject: Backport: Add constexpr, const, noexcept and make other small improvements to lexlib. Backport of changeset 8416:06a43e06a8e0. --- lexlib/SparseState.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lexlib/SparseState.h') 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); } -- cgit v1.2.3