diff --git a/src/util/ConstBuffer.hxx b/src/util/ConstBuffer.hxx index d71088588..cea0bddf8 100644 --- a/src/util/ConstBuffer.hxx +++ b/src/util/ConstBuffer.hxx @@ -105,6 +105,13 @@ struct ConstBuffer { constexpr ConstBuffer(pointer_type _data, size_type _size) :data(_data), size(_size) {} + /** + * Convert array to ConstBuffer instance. + */ + template + constexpr ConstBuffer(const T (&_data)[_size]) + :data(_data), size(_size) {} + constexpr static ConstBuffer Null() { return ConstBuffer(nullptr, 0); } 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 + constexpr WritableBuffer(T (&_data)[_size]) + :data(_data), size(_size) {} + constexpr static WritableBuffer Null() { return { nullptr, 0 }; }