diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-01-09 08:39:08 -0800 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-01-09 08:47:47 -0800 |
commit | 07fd147b9f12e9205afd66a624edce357977d615 (patch) | |
tree | 33f3d9ddf2a5c3a2866889edf3817b6656f0e61f /src/streams.h | |
parent | 12e31127948fa4bb01c3bddc1b8c85b432f7465b (diff) | |
parent | 5113474a91b8dcac4de0e4566b9babd5da281f29 (diff) |
Merge #9353: Add data() method to CDataStream (and use it)
5113474 wallet: Use CDataStream.data() (Wladimir J. van der Laan)
e2300ff bench: Use CDataStream.data() (Wladimir J. van der Laan)
adff950 dbwrapper: Use new .data() method of CDataStream (Wladimir J. van der Laan)
a2141e4 streams: Remove special cases for ancient MSVC (Wladimir J. van der Laan)
af4c44c streams: Add data() method to CDataStream (Wladimir J. van der Laan)
Diffstat (limited to 'src/streams.h')
-rw-r--r-- | src/streams.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/streams.h b/src/streams.h index 471602227a..1d3b55c91e 100644 --- a/src/streams.h +++ b/src/streams.h @@ -174,12 +174,10 @@ public: Init(nTypeIn, nVersionIn); } -#if !defined(_MSC_VER) || _MSC_VER >= 1300 CDataStream(const char* pbegin, const char* pend, int nTypeIn, int nVersionIn) : vch(pbegin, pend) { Init(nTypeIn, nVersionIn); } -#endif CDataStream(const vector_type& vchIn, int nTypeIn, int nVersionIn) : vch(vchIn.begin(), vchIn.end()) { @@ -245,6 +243,8 @@ public: void clear() { vch.clear(); nReadPos = 0; } iterator insert(iterator it, const char& x=char()) { return vch.insert(it, x); } void insert(iterator it, size_type n, const char& x) { vch.insert(it, n, x); } + value_type* data() { return vch.data() + nReadPos; } + const value_type* data() const { return vch.data() + nReadPos; } void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last) { @@ -259,7 +259,6 @@ public: vch.insert(it, first, last); } -#if !defined(_MSC_VER) || _MSC_VER >= 1300 void insert(iterator it, const char* first, const char* last) { assert(last - first >= 0); @@ -272,7 +271,6 @@ public: else vch.insert(it, first, last); } -#endif iterator erase(iterator it) { |