Commit 9237f2a8 authored by Max Kellermann's avatar Max Kellermann

util/{Const,Writable}Buffer: add array constructor

parent 61aca389
......@@ -105,6 +105,13 @@ struct ConstBuffer {
constexpr ConstBuffer(pointer_type _data, size_type _size)
:data(_data), size(_size) {}
/**
* Convert array to ConstBuffer instance.
*/
template<size_type _size>
constexpr ConstBuffer(const T (&_data)[_size])
:data(_data), size(_size) {}
constexpr static ConstBuffer Null() {
return ConstBuffer(nullptr, 0);
}
......
......@@ -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 };
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment