aboutsummaryrefslogtreecommitdiff
path: root/src/mruset.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-09-19 19:21:46 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-09-19 19:21:46 +0200
commit20e01b1a03819d843a860284033b48a5e3b65ff7 (patch)
tree5b390722b053ce5b448919bda2695d173980ffb5 /src/mruset.h
parent2fc6c67400e91846ca1c1c57011e57491013f9bd (diff)
Apply clang-format on some infrequently-updated files
Diffstat (limited to 'src/mruset.h')
-rw-r--r--src/mruset.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mruset.h b/src/mruset.h
index b9f325d874..1691875f57 100644
--- a/src/mruset.h
+++ b/src/mruset.h
@@ -10,7 +10,8 @@
#include <utility>
/** STL-like set container that only keeps the most recent N elements. */
-template <typename T> class mruset
+template <typename T>
+class mruset
{
public:
typedef T key_type;
@@ -32,17 +33,19 @@ public:
bool empty() const { return set.empty(); }
iterator find(const key_type& k) const { return set.find(k); }
size_type count(const key_type& k) const { return set.count(k); }
- void clear() { set.clear(); queue.clear(); }
+ void clear()
+ {
+ set.clear();
+ queue.clear();
+ }
bool inline friend operator==(const mruset<T>& a, const mruset<T>& b) { return a.set == b.set; }
bool inline friend operator==(const mruset<T>& a, const std::set<T>& b) { return a.set == b; }
bool inline friend operator<(const mruset<T>& a, const mruset<T>& b) { return a.set < b.set; }
std::pair<iterator, bool> insert(const key_type& x)
{
std::pair<iterator, bool> ret = set.insert(x);
- if (ret.second)
- {
- if (nMaxSize && queue.size() == nMaxSize)
- {
+ if (ret.second) {
+ if (nMaxSize && queue.size() == nMaxSize) {
set.erase(queue.front());
queue.pop_front();
}
@@ -54,8 +57,7 @@ public:
size_type max_size(size_type s)
{
if (s)
- while (queue.size() > s)
- {
+ while (queue.size() > s) {
set.erase(queue.front());
queue.pop_front();
}