summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-11-15 22:03:44 +0100
committerMax Kellermann <max@musicpd.org>2018-01-16 11:06:33 +0100
commit0066f7a818a5e49e53c140ce4da830c3c4f19960 (patch)
treea8565d46cc492daa075f4ac6f6cd38bff0c410cc /src/util
parent65059f2addbc7a39e93440eae6c541c4d2885ef1 (diff)
util/{Const,Writable}Buffer: add constructor with two pointers
Diffstat (limited to 'src/util')
-rw-r--r--src/util/ConstBuffer.hxx3
-rw-r--r--src/util/WritableBuffer.hxx3
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.
*/