summaryrefslogtreecommitdiff
path: root/src/util/container.h
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-19 22:23:47 +0200
committerGitHub <noreply@github.com>2017-08-19 22:23:47 +0200
commit88b436e6a9c98af7215bd115e1b7a3f1a1db99d3 (patch)
treef07cdd7f93ca26b84192d7b89f7b952e603ba5cf /src/util/container.h
parent7528986e4449febead9b18b6118f0b096f7cf800 (diff)
downloadminetest-88b436e6a9c98af7215bd115e1b7a3f1a1db99d3.tar.gz
minetest-88b436e6a9c98af7215bd115e1b7a3f1a1db99d3.tar.bz2
minetest-88b436e6a9c98af7215bd115e1b7a3f1a1db99d3.zip
Code modernization: subfolders (#6283)
* Code modernization: subfolders Modernize various code on subfolders client, network, script, threading, unittests, util * empty function * default constructor/destructor * for range-based loops * use emplace_back instead of push_back * C++ STL header style * Make connection.cpp readable in a pointed place + typo
Diffstat (limited to 'src/util/container.h')
-rw-r--r--src/util/container.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/util/container.h b/src/util/container.h
index af85d80e3..81f085017 100644
--- a/src/util/container.h
+++ b/src/util/container.h
@@ -79,7 +79,7 @@ template<typename Key, typename Value>
class MutexedMap
{
public:
- MutexedMap() {}
+ MutexedMap() = default;
void set(const Key &name, const Value &value)
{
@@ -128,7 +128,8 @@ public:
template<typename Key, typename U, typename Caller, typename CallerData>
friend class RequestQueue;
- MutexedQueue() {}
+ MutexedQueue() = default;
+
bool empty() const
{
MutexAutoLock lock(m_mutex);
@@ -153,9 +154,9 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
T t = m_queue.back();
m_queue.pop_back();
return t;
- } else {
- return T();
}
+
+ return T();
}
T pop_backNoEx()