aboutsummaryrefslogtreecommitdiff
path: root/src/prevector.h
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-01-18 15:24:00 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-01-18 15:46:33 +0100
commitfab8a01048fc6cfcee7e89884a5af31385189c63 (patch)
treee4748ff473c09df2283d6c42c259a46e1f5ace0b /src/prevector.h
parentfa44a60b2bb5cb91bc411e5b625fc81bd84befff (diff)
downloadbitcoin-fab8a01048fc6cfcee7e89884a5af31385189c63.tar.xz
refactor: Fix binary operator+ for prevector iterators
Diffstat (limited to 'src/prevector.h')
-rw-r--r--src/prevector.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/prevector.h b/src/prevector.h
index f643a0d591..8b07d8c289 100644
--- a/src/prevector.h
+++ b/src/prevector.h
@@ -65,6 +65,7 @@ public:
iterator operator--(int) { iterator copy(*this); --(*this); return copy; }
difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
iterator operator+(size_type n) const { return iterator(ptr + n); }
+ iterator friend operator+(size_type n, iterator x) { return x + n; }
iterator& operator+=(size_type n) { ptr += n; return *this; }
iterator operator-(size_type n) const { return iterator(ptr - n); }
iterator& operator-=(size_type n) { ptr -= n; return *this; }
@@ -116,6 +117,7 @@ public:
const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
const_iterator operator+(size_type n) const { return const_iterator(ptr + n); }
+ const_iterator friend operator+(size_type n, const_iterator x) { return x + n; }
const_iterator& operator+=(size_type n) { ptr += n; return *this; }
const_iterator operator-(size_type n) const { return const_iterator(ptr - n); }
const_iterator& operator-=(size_type n) { ptr -= n; return *this; }