From: Mikko Rasa Date: Sun, 4 Dec 2022 20:15:26 +0000 (+0200) Subject: Minor optimization to AccessGuard::check X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=bdcd6a6268dec57ad352e30d86734b28a885a017;p=libs%2Fgame.git Minor optimization to AccessGuard::check It doesn't need to resize the vector since it can just use the default flag. --- 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()