From fa8bdb048e65cae2d26bea3f991717a856e2fb39 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 23 Nov 2020 18:53:44 +0100 Subject: refactor: Drop CDataStream constructors in favor of one taking a Span of bytes --- src/streams.h | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) (limited to 'src/streams.h') diff --git a/src/streams.h b/src/streams.h index 793c06b5c5..53924d76ed 100644 --- a/src/streams.h +++ b/src/streams.h @@ -6,8 +6,9 @@ #ifndef BITCOIN_STREAMS_H #define BITCOIN_STREAMS_H -#include #include +#include +#include #include #include @@ -15,8 +16,8 @@ #include #include #include -#include #include +#include #include #include @@ -225,27 +226,8 @@ public: Init(nTypeIn, nVersionIn); } - CDataStream(const_iterator pbegin, const_iterator pend, int nTypeIn, int nVersionIn) : vch(pbegin, pend) - { - Init(nTypeIn, nVersionIn); - } - - CDataStream(const char* pbegin, const char* pend, int nTypeIn, int nVersionIn) : vch(pbegin, pend) - { - Init(nTypeIn, nVersionIn); - } - - CDataStream(const vector_type& vchIn, int nTypeIn, int nVersionIn) : vch(vchIn.begin(), vchIn.end()) - { - Init(nTypeIn, nVersionIn); - } - - CDataStream(const std::vector& vchIn, int nTypeIn, int nVersionIn) : vch(vchIn.begin(), vchIn.end()) - { - Init(nTypeIn, nVersionIn); - } - - CDataStream(const std::vector& vchIn, int nTypeIn, int nVersionIn) : vch(vchIn.begin(), vchIn.end()) + explicit CDataStream(Span sp, int nTypeIn, int nVersionIn) + : vch(sp.data(), sp.data() + sp.size()) { Init(nTypeIn, nVersionIn); } @@ -289,7 +271,7 @@ public: value_type* data() { return vch.data() + nReadPos; } const value_type* data() const { return vch.data() + nReadPos; } - void insert(iterator it, std::vector::const_iterator first, std::vector::const_iterator last) + void insert(iterator it, std::vector::const_iterator first, std::vector::const_iterator last) { if (last == first) return; assert(last - first > 0); -- cgit v1.2.3