From af4c44ce59aa643b3e03eaa121ec075f524227a5 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 15 Dec 2016 17:15:34 +0100 Subject: streams: Add data() method to CDataStream Analogous to c++11 vector data(). --- src/streams.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/streams.h') diff --git a/src/streams.h b/src/streams.h index b508784238..3755069982 100644 --- a/src/streams.h +++ b/src/streams.h @@ -245,6 +245,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::const_iterator first, std::vector::const_iterator last) { -- cgit v1.2.3 From a2141e415aed26bab756220d8707b5fb33e6fef8 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 15 Dec 2016 17:17:42 +0100 Subject: streams: Remove special cases for ancient MSVC Quite sure that we haven't supported MSVC 6.0 for ages (MSC_VER 1300 is >= MSVC++ 7.0) but with the C++11 switch we can be sure. --- src/streams.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/streams.h') diff --git a/src/streams.h b/src/streams.h index 3755069982..4605068116 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()) { @@ -261,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); @@ -274,7 +271,6 @@ public: else vch.insert(it, first, last); } -#endif iterator erase(iterator it) { -- cgit v1.2.3