From: Maksym Mamontov Date: Mon, 27 Jan 2020 21:23:57 +0000 (+0200) Subject: Remove std::list from actions. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/12b88fa193a36e0d4ed35b1912e5cf1dfe633ce6 Remove std::list from actions. --- diff --git a/stargazer/actions.h b/stargazer/actions.h index 66b8556d..eea72b77 100644 --- a/stargazer/actions.h +++ b/stargazer/actions.h @@ -14,7 +14,7 @@ // actionsList.InvokeAll(); #include -#include +#include #include // Generalized actor type - a method of some class with one argument @@ -54,11 +54,11 @@ private: // A list of an actions // All methods are thread-safe -class ACTIONS_LIST : private std::list +class ACTIONS_LIST : private std::vector { public: // Just a typedef for parent class - typedef std::list parent; + typedef std::vector parent; // Initialize mutex ACTIONS_LIST(); diff --git a/stargazer/actions.inl.h b/stargazer/actions.inl.h index b5b3f8a5..392626ab 100644 --- a/stargazer/actions.inl.h +++ b/stargazer/actions.inl.h @@ -29,7 +29,7 @@ ACTIONS_LIST::~ACTIONS_LIST() STG_LOCKER lock(&mutex); parent::iterator it(parent::begin()); - while (it != parent::end()) + while (it != parent::end()) { delete *it++; } @@ -40,28 +40,28 @@ pthread_mutex_destroy(&mutex); inline ACTIONS_LIST::parent::iterator ACTIONS_LIST::begin() -{ +{ STG_LOCKER lock(&mutex); return parent::begin(); } inline ACTIONS_LIST::parent::iterator ACTIONS_LIST::end() -{ +{ STG_LOCKER lock(&mutex); return parent::end(); } inline ACTIONS_LIST::parent::const_iterator ACTIONS_LIST::begin() const -{ +{ STG_LOCKER lock(&mutex); return parent::begin(); } inline ACTIONS_LIST::parent::const_iterator ACTIONS_LIST::end() const -{ +{ STG_LOCKER lock(&mutex); return parent::end(); }