summaryrefslogtreecommitdiff
path: root/src/util/WritableBuffer.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-04-12 13:09:11 +0200
committerMax Kellermann <max@musicpd.org>2017-07-05 12:09:27 +0200
commit9237f2a80c3549fdc473b2ff08b2457204760180 (patch)
treed6e5d2f27044f0051909e4c4d2b5482ea497b532 /src/util/WritableBuffer.hxx
parent61aca389c467a3fe38cd51144f2fba0e7cf78ec9 (diff)
util/{Const,Writable}Buffer: add array constructor
Diffstat (limited to 'src/util/WritableBuffer.hxx')
-rw-r--r--src/util/WritableBuffer.hxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/WritableBuffer.hxx b/src/util/WritableBuffer.hxx
index 2782fecf1..fc3b872ab 100644
--- a/src/util/WritableBuffer.hxx
+++ b/src/util/WritableBuffer.hxx
@@ -99,6 +99,13 @@ struct WritableBuffer {
constexpr WritableBuffer(pointer_type _data, size_type _size)
:data(_data), size(_size) {}
+ /**
+ * Convert array to WritableBuffer instance.
+ */
+ template<size_type _size>
+ constexpr WritableBuffer(T (&_data)[_size])
+ :data(_data), size(_size) {}
+
constexpr static WritableBuffer Null() {
return { nullptr, 0 };
}