diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2014-09-21 01:03:32 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2014-09-21 01:10:14 +0200 |
commit | 934b153a2caba4071a614e5b3ef40feeaff631d4 (patch) | |
tree | 3d95becb8f49ad812227c5f3bfafddec4c72f6d3 /src/mruset.h | |
parent | 25308337d659108e3320257fb6c1c16d5fe24aa9 (diff) | |
parent | 20e01b1a03819d843a860284033b48a5e3b65ff7 (diff) |
Merge pull request #4933
20e01b1 Apply clang-format on some infrequently-updated files (Pieter Wuille)
Diffstat (limited to 'src/mruset.h')
-rw-r--r-- | src/mruset.h | 18 |
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(); } |