diff options
author | Max Kellermann <max@musicpd.org> | 2017-11-15 22:03:44 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-01-16 11:06:33 +0100 |
commit | 0066f7a818a5e49e53c140ce4da830c3c4f19960 (patch) | |
tree | a8565d46cc492daa075f4ac6f6cd38bff0c410cc /src/util | |
parent | 65059f2addbc7a39e93440eae6c541c4d2885ef1 (diff) |
util/{Const,Writable}Buffer: add constructor with two pointers
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/ConstBuffer.hxx | 3 | ||||
-rw-r--r-- | src/util/WritableBuffer.hxx | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/util/ConstBuffer.hxx b/src/util/ConstBuffer.hxx index 6c9df593b..74fe297b5 100644 --- a/src/util/ConstBuffer.hxx +++ b/src/util/ConstBuffer.hxx @@ -109,6 +109,9 @@ struct ConstBuffer { constexpr ConstBuffer(pointer_type _data, size_type _size) :data(_data), size(_size) {} + constexpr ConstBuffer(pointer_type _data, pointer_type _end) + :data(_data), size(_end - _data) {} + /** * Convert array to ConstBuffer instance. */ diff --git a/src/util/WritableBuffer.hxx b/src/util/WritableBuffer.hxx index a86ec50e5..605ccebe0 100644 --- a/src/util/WritableBuffer.hxx +++ b/src/util/WritableBuffer.hxx @@ -103,6 +103,9 @@ struct WritableBuffer { constexpr WritableBuffer(pointer_type _data, size_type _size) :data(_data), size(_size) {} + constexpr WritableBuffer(pointer_type _data, pointer_type _end) + :data(_data), size(_end - _data) {} + /** * Convert array to WritableBuffer instance. */ |