From b3c9933350e5c6b9d06a72034e681cecae52dc4b Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 16 Jul 2020 19:55:15 +1000 Subject: Add constexpr, const, noexcept and make other small improvements to lexlib. --- 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