Skip to content

Commit af4c44c

Browse files
committed
streams: Add data() method to CDataStream
Analogous to c++11 vector data().
1 parent c6fd923 commit af4c44c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/streams.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ class CDataStream
245245
void clear() { vch.clear(); nReadPos = 0; }
246246
iterator insert(iterator it, const char& x=char()) { return vch.insert(it, x); }
247247
void insert(iterator it, size_type n, const char& x) { vch.insert(it, n, x); }
248+
value_type* data() { return vch.data() + nReadPos; }
249+
const value_type* data() const { return vch.data() + nReadPos; }
248250

249251
void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
250252
{

0 commit comments

Comments
 (0)