X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Futil%2Fcontainer.h;h=2ad2bbfc740362da4447b9ae6293c82d416e0c6d;hb=84a5fa01fff2b81fae12411c31502a49f152ed1d;hp=af85d80e39ba83151cac3766c17f602d4dfd6f08;hpb=921151d97a2fb2238ab514324fb95e2732248b96;p=minetest.git diff --git a/src/util/container.h b/src/util/container.h index af85d80e3..2ad2bbfc7 100644 --- a/src/util/container.h +++ b/src/util/container.h @@ -19,10 +19,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once -#include "../irrlichttypes.h" -#include "../exceptions.h" -#include "../threading/mutex_auto_lock.h" -#include "../threading/semaphore.h" +#include "irrlichttypes.h" +#include "exceptions.h" +#include "threading/mutex_auto_lock.h" +#include "threading/semaphore.h" #include #include #include @@ -79,7 +79,7 @@ template class MutexedMap { public: - MutexedMap() {} + MutexedMap() = default; void set(const Key &name, const Value &value) { @@ -128,7 +128,8 @@ class MutexedQueue template friend class RequestQueue; - MutexedQueue() {} + MutexedQueue() = default; + bool empty() const { MutexAutoLock lock(m_mutex); @@ -153,9 +154,9 @@ class MutexedQueue T t = m_queue.front(); m_queue.pop_front(); return t; - } else { - return T(); } + + return T(); } T pop_front(u32 wait_time_max_ms) @@ -166,9 +167,9 @@ class MutexedQueue T t = m_queue.front(); m_queue.pop_front(); return t; - } else { - throw ItemNotFoundException("MutexedQueue: queue is empty"); } + + throw ItemNotFoundException("MutexedQueue: queue is empty"); } T pop_frontNoEx() @@ -190,9 +191,9 @@ class MutexedQueue T t = m_queue.back(); m_queue.pop_back(); return t; - } else { - throw ItemNotFoundException("MutexedQueue: queue is empty"); } + + throw ItemNotFoundException("MutexedQueue: queue is empty"); } /* this version of pop_back returns a empty element of T on timeout. @@ -206,9 +207,9 @@ class MutexedQueue T t = m_queue.back(); m_queue.pop_back(); return t; - } else { - return T(); } + + return T(); } T pop_backNoEx()