From bdcd6a6268dec57ad352e30d86734b28a885a017 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 4 Dec 2022 22:15:26 +0200 Subject: [PATCH] Minor optimization to AccessGuard::check It doesn't need to resize the vector since it can just use the default flag. --- source/game/accessguard.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/game/accessguard.h b/source/game/accessguard.h index 26bbb4e..0f7bac7 100644 --- a/source/game/accessguard.h +++ b/source/game/accessguard.h @@ -69,7 +69,7 @@ public: void unblock() { get() = UNBLOCKED; } template - void check() { if(get()!=UNBLOCKED) throw invalid_access(T::describe()); } + void check(); }; @@ -97,6 +97,14 @@ template<> inline void AccessGuard::unblock() { unblock_all(); } +template +inline void AccessGuard::check() +{ + unsigned index = get_index(); + if((index inline std::string AccessGuard::Read::describe() -- 2.43.0