aboutsummaryrefslogtreecommitdiff
path: root/src/limitedmap.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/limitedmap.h
parent2fc6c67400e91846ca1c1c57011e57491013f9bd (diff)
Apply clang-format on some infrequently-updated files
Diffstat (limited to 'src/limitedmap.h')
-rw-r--r--src/limitedmap.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/limitedmap.h b/src/limitedmap.h
index 58593688af..4bc8d9e5aa 100644
--- a/src/limitedmap.h
+++ b/src/limitedmap.h
@@ -9,7 +9,8 @@
#include <map>
/** STL-like map container that only keeps the N elements with the highest value. */
-template <typename K, typename V> class limitedmap
+template <typename K, typename V>
+class limitedmap
{
public:
typedef K key_type;
@@ -36,10 +37,8 @@ public:
void insert(const value_type& x)
{
std::pair<iterator, bool> ret = map.insert(x);
- if (ret.second)
- {
- if (nMaxSize && map.size() == nMaxSize)
- {
+ if (ret.second) {
+ if (nMaxSize && map.size() == nMaxSize) {
map.erase(rmap.begin()->second);
rmap.erase(rmap.begin());
}
@@ -54,8 +53,7 @@ public:
return;
std::pair<rmap_iterator, rmap_iterator> itPair = rmap.equal_range(itTarget->second);
for (rmap_iterator it = itPair.first; it != itPair.second; ++it)
- if (it->second == itTarget)
- {
+ if (it->second == itTarget) {
rmap.erase(it);
map.erase(itTarget);
return;
@@ -72,8 +70,7 @@ public:
return;
std::pair<rmap_iterator, rmap_iterator> itPair = rmap.equal_range(itTarget->second);
for (rmap_iterator it = itPair.first; it != itPair.second; ++it)
- if (it->second == itTarget)
- {
+ if (it->second == itTarget) {
rmap.erase(it);
itTarget->second = v;
rmap.insert(make_pair(v, itTarget));
@@ -88,8 +85,7 @@ public:
size_type max_size(size_type s)
{
if (s)
- while (map.size() > s)
- {
+ while (map.size() > s) {
map.erase(rmap.begin()->second);
rmap.erase(rmap.begin());
}