diff options
author | luigi1111 <luigi1111w@gmail.com> | 2022-04-18 02:12:55 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2022-04-18 02:12:55 -0500 |
commit | 2b999f5398426d2c4452e001cfebad34abb686ff (patch) | |
tree | 08bbe9298a72bd99ca3e35d3df667d81ef07711e /contrib | |
parent | Merge pull request #8242 (diff) | |
parent | Fee changes from ArticMine (diff) | |
download | monero-2b999f5398426d2c4452e001cfebad34abb686ff.tar.xz |
Merge pull request #7819
b030f20 Fee changes from ArticMine (moneromooo-monero)
9f786f0 epee: allow copying a rolling_median_t object (moneromooo-monero)
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/rolling_median.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/contrib/epee/include/rolling_median.h b/contrib/epee/include/rolling_median.h index 8965a8268..e230fd974 100644 --- a/contrib/epee/include/rolling_median.h +++ b/contrib/epee/include/rolling_median.h @@ -126,7 +126,6 @@ private: protected: rolling_median_t &operator=(const rolling_median_t&) = delete; - rolling_median_t(const rolling_median_t&) = delete; public: //creates new rolling_median_t: to calculate `nItems` running median. @@ -139,6 +138,20 @@ public: clear(); } + rolling_median_t(const rolling_median_t &other) + { + N = other.N; + int size = N * (sizeof(Item) + sizeof(int) * 2); + data = (Item*)malloc(size); + memcpy(data, other.data, size); + pos = (int*) (data + N); + heap = pos + N + (N / 2); //points to middle of storage. + idx = other.idx; + minCt = other.minCt; + maxCt = other.maxCt; + sz = other.sz; + } + rolling_median_t(rolling_median_t &&m) { memcpy(this, &m, sizeof(rolling_median_t)); |